Use access() instead of stat() for checking whether scripts exist.
[tinc] / src / process.c
index d07ce7d..544c224 100644 (file)
@@ -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;
 
@@ -380,12 +379,14 @@ bool execute_script(const char *name, char **envp)
 
        scriptname[len - 1] = '\0';
 
+#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;
        }
+#endif
 
        ifdebug(STATUS) logger(LOG_INFO, _("Executing script %s"), name);