]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
execute: Use pakfire_jail_run() to call ldconfig
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 2 Aug 2022 18:09:46 +0000 (18:09 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 2 Aug 2022 18:09:46 +0000 (18:09 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/execute.c

index 34d7710e08b820ba18b74cf374a2334776fcefad..d6ca176aa8e8d76aab26e132d5b0d68ade70169c 100644 (file)
@@ -1015,13 +1015,17 @@ int pakfire_execute_ldconfig(struct pakfire* pakfire) {
        if (r < 0)
                return 1;
 
-       r = -1;
-
-       if (access(path, X_OK) == 0) {
-               r = pakfire_execute_command(pakfire, LDCONFIG, NULL, 0, NULL, NULL);
-
-               DEBUG(pakfire, "ldconfig returned %d\n", r);
+       // Check if ldconfig is executable
+       r = access(path, X_OK);
+       if (r) {
+               DEBUG(pakfire, "%s is not executable. Skipping...\n", LDCONFIG);
+               return 0;
        }
 
-       return r;
+       const char* argv[] = {
+               LDCONFIG, NULL,
+       };
+
+       // Run ldconfig
+       return pakfire_jail_run(pakfire, argv, 0);
 }