}
}
- // Activate
- int r = pakfire_activate(pakfire);
- if (r)
- return r;
-
// Fork this process
pid_t pid = clone(pakfire_execute_fork, stack + sizeof(stack), cflags, &env);
if (pid < 0) {
ERROR(pakfire, "Could not fork: %s\n", strerror(errno));
- pakfire_deactivate(pakfire);
-
return -errno;
}
// Set some useful error code
- r = -ESRCH;
+ int r = -ESRCH;
int status = 0;
DEBUG(pakfire, "Waiting for PID %d to finish its work\n", pid);
if (!status)
waitpid(pid, &status, 0);
- // Deactivate
- pakfire_deactivate(pakfire);
-
if (WIFEXITED(status)) {
r = WEXITSTATUS(status);
char* path = pakfire_path_join(root, "tmp/.pakfire-script.XXXXXX");
int r;
- // Activate
- r = pakfire_activate(pakfire);
- if (r)
- return r;
-
// Open a temporary file
int fd = mkstemp(path);
if (fd < 0) {
// Remove script from disk
unlink(path);
- // Deactivate
- pakfire_deactivate(pakfire);
-
// Cleanup
free(path);
const char* pakfire_get_path(Pakfire pakfire);
char* pakfire_make_path(Pakfire pakfire, const char* path);
-int pakfire_activate(Pakfire pakfire);
-int pakfire_deactivate(Pakfire pakfire);
int pakfire_bind(Pakfire pakfire, const char* src, const char* dst, int flags);
const char* pakfire_get_arch(Pakfire pakfire);
LIBPAKFIRE_0 {
global:
# pakfire
- pakfire_activate;
pakfire_bind;
pakfire_count_packages;
pakfire_create;
- pakfire_deactivate;
pakfire_execute;
pakfire_execute_command;
pakfire_execute_script;
pakfire_log_function_t log_function;
int log_priority;
- int activated;
int nrefs;
STAILQ_HEAD(mountpoints, mountpoint) mountpoints;
return r;
}
-PAKFIRE_EXPORT int pakfire_activate(Pakfire pakfire) {
- return 0;
-}
-
-PAKFIRE_EXPORT int pakfire_deactivate(Pakfire pakfire) {
- return 0;
-}
-
PAKFIRE_EXPORT const char* pakfire_get_arch(Pakfire pakfire) {
return pakfire->arch;
}
DEBUG(transaction->pakfire, "Running Transaction %p\n", transaction);
- // Activate Pakfire
- r = pakfire_activate(transaction->pakfire);
- if (r)
- return r;
-
// Open the database
r = pakfire_db_open(&db, transaction->pakfire, PAKFIRE_DB_READWRITE);
if (r) {
// Free the database
pakfire_db_unref(db);
- // Deactivate Pakfire
- pakfire_deactivate(transaction->pakfire);
-
return r;
}