if (r) {
// Drop to a shell for debugging
if (pakfire_has_flag(pakfire, PAKFIRE_FLAGS_INTERACTIVE))
- pakfire_execute_shell(pakfire);
+ pakfire_jail_shell(pakfire);
goto ERROR;
}
if (r)
return r;
- return pakfire_execute_shell(pakfire);
+ return pakfire_jail_shell(pakfire);
}
int pakfire_build_clean(struct pakfire* pakfire, int flags) {
#include <pakfire/private.h>
#include <pakfire/util.h>
-#define LDCONFIG "/sbin/ldconfig"
-
PAKFIRE_EXPORT int pakfire_execute(struct pakfire* pakfire, const char* argv[], char* envp[],
int flags, pakfire_execute_logging_callback logging_callback, void* data) {
struct pakfire_jail* jail = NULL;
return r;
}
-int pakfire_execute_shell(struct pakfire* pakfire) {
- const char* argv[] = {
- "/bin/bash", "--login", NULL,
- };
-
- // Execute /bin/bash
- return pakfire_jail_run(pakfire, argv, PAKFIRE_JAIL_INTERACTIVE, NULL);
-}
-
-int pakfire_execute_ldconfig(struct pakfire* pakfire) {
- char path[PATH_MAX];
-
- // Check if ldconfig exists before calling it to avoid overhead
- int r = pakfire_make_path(pakfire, path, LDCONFIG);
- if (r < 0)
- return 1;
-
- // Check if ldconfig is executable
- r = access(path, X_OK);
- if (r) {
- DEBUG(pakfire, "%s is not executable. Skipping...\n", LDCONFIG);
- return 0;
- }
-
- const char* argv[] = {
- LDCONFIG, NULL,
- };
-
- // Run ldconfig
- return pakfire_jail_run(pakfire, argv, 0, NULL);
-}
PAKFIRE_EXECUTE_INTERACTIVE = (1 << 1),
};
-#ifdef PAKFIRE_PRIVATE
-
-int pakfire_execute_shell(struct pakfire* pakfire);
-int pakfire_execute_ldconfig(struct pakfire* pakfire);
-
-#endif
-
#endif /* PAKFIRE_EXECUTE_H */
int pakfire_jail_run_script(struct pakfire* pakfire,
const char* script, const size_t length, const char* argv[], int flags, char*** output);
+int pakfire_jail_shell(struct pakfire* pakfire);
+int pakfire_jail_ldconfig(struct pakfire* pakfire);
+
#endif
#endif /* PAKFIRE_JAIL_H */
return r;
}
+
+
+int pakfire_jail_shell(struct pakfire* pakfire) {
+ const char* argv[] = {
+ "/bin/bash", "--login", NULL,
+ };
+
+ // Execute /bin/bash
+ return pakfire_jail_run(pakfire, argv, PAKFIRE_JAIL_INTERACTIVE, NULL);
+}
+
+int pakfire_jail_ldconfig(struct pakfire* pakfire) {
+ char path[PATH_MAX];
+
+ const char* ldconfig = "/sbin/ldconfig";
+
+ // Check if ldconfig exists before calling it to avoid overhead
+ int r = pakfire_make_path(pakfire, path, ldconfig);
+ if (r < 0)
+ return 1;
+
+ // Check if ldconfig is executable
+ r = access(path, X_OK);
+ if (r) {
+ DEBUG(pakfire, "%s is not executable. Skipping...\n", ldconfig);
+ return 0;
+ }
+
+ const char* argv[] = {
+ ldconfig, NULL,
+ };
+
+ // Run ldconfig
+ return pakfire_jail_run(pakfire, argv, 0, NULL);
+}
#include <pakfire/archive.h>
#include <pakfire/db.h>
#include <pakfire/downloader.h>
-#include <pakfire/execute.h>
#include <pakfire/file.h>
#include <pakfire/filelist.h>
#include <pakfire/i18n.h>
+#include <pakfire/jail.h>
#include <pakfire/logging.h>
#include <pakfire/package.h>
#include <pakfire/pakfire.h>
// Update the runtime linker cache
if (need_ldconfig)
- pakfire_execute_ldconfig(transaction->pakfire);
+ pakfire_jail_ldconfig(transaction->pakfire);
pakfire_filelist_unref(filelist);
}
}
// Update the runtime linker cache after all files have been removed
- pakfire_execute_ldconfig(transaction->pakfire);
+ pakfire_jail_ldconfig(transaction->pakfire);
ERROR:
if (filelist)