Trying to open file for checking file existence seems to be too much. Instead use access system call which is meant for the same. Signed-off-by: Rahul Bedarkar <rahulbedarkar89@xxxxxxxxx> --- Note: Compile tested only on Linux/x86 --- src/utils/os_unix.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c index 0118d98..aa09709 100644 --- a/src/utils/os_unix.c +++ b/src/utils/os_unix.c @@ -435,11 +435,10 @@ char * os_readfile(const char *name, size_t *len) int os_file_exists(const char *fname) { - FILE *f = fopen(fname, "rb"); - if (f == NULL) + if (access(fname, F_OK) == 0) + return 1; + else return 0; - fclose(f); - return 1; } -- 1.8.3.2 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap