aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorRahul Bedarkar <rahulbedarkar89@gmail.com>2016-07-27 16:47:53 (GMT)
committerJouni Malinen <j@w1.fi>2016-08-07 21:24:07 (GMT)
commita2072a29b9cece5a710871f1d0c1bf1d25e3a712 (patch)
tree0a9beb2cbb153d7b4715d6004df21ee210027640 /src/utils
parentcfe0a0194b9d666593a1495980a1591c9c948da8 (diff)
downloadhostap-a2072a29b9cece5a710871f1d0c1bf1d25e3a712.zip
hostap-a2072a29b9cece5a710871f1d0c1bf1d25e3a712.tar.gz
hostap-a2072a29b9cece5a710871f1d0c1bf1d25e3a712.tar.bz2
utils: os_unix: Use access() for checking file existence
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@gmail.com>
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/os_unix.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c
index 0118d98..65c6fa4 100644
--- a/src/utils/os_unix.c
+++ b/src/utils/os_unix.c
@@ -435,11 +435,7 @@ 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;
+ return access(fname, F_OK) == 0;
}