From cd73c1c95146e23ab1c21cc4bb18ed2c9308efa3 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 22 Nov 2017 14:40:02 +0100 Subject: [PATCH] Replace libite:fmode() with stat(), removed in libite v2 Signed-off-by: Joachim Nilsson --- src/exec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/exec.c b/src/exec.c index 0b93dc9c..359eacb5 100644 --- a/src/exec.c +++ b/src/exec.c @@ -430,14 +430,18 @@ int run_parts(char *dir, char *cmd) for (i = 0; i < num; i++) { int j = 0; pid_t pid = 0; - mode_t mode; + struct stat st; char *args[NUM_ARGS]; char *name = e[i]->d_name; char path[LINE_SIZE]; snprintf(path, sizeof(path), "%s/%s", dir, name); - mode = fmode(path); - if (!S_ISEXEC(mode) || S_ISDIR(mode)) { + if (stat(path, &st)) { + _d("Failed stat(%s): %s", path, strerror(errno)); + continue; + } + + if (!S_ISEXEC(st.st_mode) || S_ISDIR(st.st_mode)) { _d("Skipping %s ...", path); continue; }