]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: use X_OK when looking for executables
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 16 Sep 2020 08:19:25 +0000 (10:19 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 18 Sep 2020 13:28:48 +0000 (15:28 +0200)
Other tools silently ignore non-executable names found in path. By checking
F_OK, we would could pick non-executable path even though there is an executable
one later.

src/core/load-fragment.c

index 701ed7487d52e437e67e6d56e94677d3bef24541..617adb848e08fc1eebfcc8f9db47bbc4a9b0dbff 100644 (file)
@@ -808,7 +808,7 @@ int config_parse_exec(
                                 if (!fullpath)
                                         return log_oom();
 
-                                if (access(fullpath, F_OK) >= 0) {
+                                if (access(fullpath, X_OK) >= 0) {
                                         free_and_replace(path, fullpath);
                                         found = true;
                                         break;