Add os_file_exists()
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
1cb3eda954
commit
d2bb2b4681
2 changed files with 17 additions and 0 deletions
|
@ -239,6 +239,13 @@ int os_unsetenv(const char *name);
|
||||||
*/
|
*/
|
||||||
char * os_readfile(const char *name, size_t *len);
|
char * os_readfile(const char *name, size_t *len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_file_exists - Check whether the specified file exists
|
||||||
|
* @fname: Path and name of the file
|
||||||
|
* Returns: 1 if the file exists or 0 if not
|
||||||
|
*/
|
||||||
|
int os_file_exists(const char *fname);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* os_zalloc - Allocate and zero memory
|
* os_zalloc - Allocate and zero memory
|
||||||
* @size: Number of bytes to allocate
|
* @size: Number of bytes to allocate
|
||||||
|
|
|
@ -407,6 +407,16 @@ char * os_readfile(const char *name, size_t *len)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int os_file_exists(const char *fname)
|
||||||
|
{
|
||||||
|
FILE *f = fopen(fname, "rb");
|
||||||
|
if (f == NULL)
|
||||||
|
return 0;
|
||||||
|
fclose(f);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef WPA_TRACE
|
#ifndef WPA_TRACE
|
||||||
void * os_zalloc(size_t size)
|
void * os_zalloc(size_t size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue