aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2014-01-24 08:30:57 -0500
committerGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2014-01-24 08:30:57 -0500
commitc2c24bc5648d087b62b0bf54df3508c3bf433010 (patch)
tree59f3db2a96b725722943fcea35801e6de577a232 /lib
parentf1e9ebd03738f21f69eb468968f7f8a5c0f2fcf7 (diff)
downloadmonitoring-plugins-c2c24bc5648d087b62b0bf54df3508c3bf433010.tar.gz
Use access() instead of stat() in parse_ini.c
Diffstat (limited to 'lib')
-rw-r--r--lib/parse_ini.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/parse_ini.c b/lib/parse_ini.c
index a1da5038..05d6a023 100644
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
@@ -49,7 +49,7 @@ static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts);
static int add_option(FILE *f, np_arg_list **optlst);
/* internal function to find default file */
static char* default_file(void);
-/* internal function to stat() files */
+/* internal function to test files access */
static int test_file(const char* env, int len, const char* file, char* temp_file);
/* parse_locator decomposes a string of the form
@@ -350,7 +350,6 @@ static char* default_file(void){
* existence. Returns 1 if found, 0 if not and -1 if test wasn't performed.
*/
static int test_file(const char* env, int len, const char* file, char* temp_file){
- struct stat sb;
/* test if len + filelen + '/' + '\0' fits in temp_file */
if((len+strlen(file)+2)>MAX_INPUT_BUFFER) return -1;
@@ -360,7 +359,7 @@ static int test_file(const char* env, int len, const char* file, char* temp_file
strncat(temp_file,"/",len+1);
strncat(temp_file,file,len+strlen(file)+1);
- if(stat(temp_file, &sb) != -1) return 1;
+ if(access(temp_file, F_OK) == 0) return 1;
return 0;
}