From: Guus Sliepen <guus@tinc-vpn.org>
Date: Mon, 14 Sep 2009 22:36:07 +0000 (+0200)
Subject: Use access() instead of stat() for checking whether scripts exist.
X-Git-Tag: import-tinc-1.1~592^2~5
X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=633c0cf1b067d118d5453bc8522fab65ffc82d2c;p=meshlink

Use access() instead of stat() for checking whether scripts exist.
---

diff --git a/src/process.c b/src/process.c
index f03f12a4..544c2242 100644
--- a/src/process.c
+++ b/src/process.c
@@ -364,7 +364,6 @@ bool execute_script(const char *name, char **envp)
 {
 #ifdef HAVE_SYSTEM
 	int status, len;
-	struct stat s;
 	char *scriptname, *p;
 	int i;
 
@@ -383,7 +382,7 @@ bool execute_script(const char *name, char **envp)
 #ifndef HAVE_TUNEMU
 	/* First check if there is a script */
 
-	if(stat(scriptname + 1, &s)) {
+	if(access(scriptname + 1, F_OK)) {
 		free(scriptname);
 		return true;
 	}