// Store path
r = pakfire_string_set(chksum->path, path);
- if (r < 0)
+ if (r)
goto ERROR;
// SHA512
DEBUG(archive->pakfire, "Extracting %s\n", archive->path);
// Set prefix for source packages
- if (pakfire_package_is_source(pkg))
- pakfire_string_format(prefix, "/usr/src/packages/%s", nevra);
+ if (pakfire_package_is_source(pkg)) {
+ r = pakfire_string_format(prefix, "/usr/src/packages/%s", nevra);
+ if (r)
+ goto ERROR;
+ }
// Open payload
payload = pakfire_archive_open_payload(archive, &a, &size);
// path
case 0:
r = pakfire_string_set(path, word);
- if (r < 0)
+ if (r)
return r;
break;
// hexdigest
case 1:
r = pakfire_string_set(hexdigest, word);
- if (r < 0)
+ if (r)
return r;
break;
// Make filename
r = pakfire_string_format(path, "signatures/%s", pakfire_key_get_fingerprint(key));
- if (r < 0)
- return 1;
+ if (r)
+ return r;
// Create a new file entry
struct archive_entry* entry = archive_entry_new();
for (const char** type = pakfire_scriptlet_types; *type; type++) {
r = pakfire_string_format(name, "scriptlet:%s", *type);
- if (r < 0)
+ if (r)
return r;
// Fetch the scriptlet
// Prepare template for this stage
int r = pakfire_string_format(template, TEMPLATE, stage);
- if (r < 0)
+ if (r)
return r;
// Fetch the environment
// Compose path
r = pakfire_string_format(path, "pakfire/build-%s", build->_id);
- if (r < 0) {
+ if (r) {
ERROR(build->pakfire, "Could not compose path for cgroup: %m\n");
return 1;
}
PAKFIRE_EXPORT int pakfire_build_set_target(
struct pakfire_build* build, const char* target) {
- pakfire_string_set(build->target, target);
-
- return 0;
+ return pakfire_string_set(build->target, target);
}
static int pakfire_build_install_packages(struct pakfire_build* build,
// Compose path to makefile
r = pakfire_string_format(makefile, "/usr/src/packages/%s/%s.nm", nevra, name);
- if (r < 0)
- return 1;
+ if (r)
+ return r;
// Make it absolute
r = pakfire_make_path(build->pakfire, path, makefile);
// Store section
r = pakfire_string_set(entry->section, section);
- if (r < 0) {
- errno = ENOBUFS;
+ if (r)
goto ERROR;
- }
// Store key
r = pakfire_string_set(entry->key, key);
- if (r < 0) {
- errno = ENOBUFS;
+ if (r)
goto ERROR;
- }
// Append it to the list of entries
STAILQ_INSERT_TAIL(&config->entries, entry, nodes);
}
// Store the value
- int r = pakfire_string_set(entry->value, value);
- if (r < 0)
- return r;
-
- return 0;
+ return pakfire_string_set(entry->value, value);
}
const char* pakfire_config_get(struct pakfire_config* config,
if (!transfer->f) {
// Make path for the temporary file (must be on the same file system)
r = pakfire_string_format(transfer->tempfile, "%s.XXXXXX", transfer->path);
- if (r < 0)
+ if (r)
return 1;
transfer->f = pakfire_mktemp(transfer->tempfile);
// Create a working copy of abspath
r = pakfire_string_set(path, file->abspath);
- if (r < 0)
+ if (r)
return r;
// See how many levels this file has
// Copy source
r = pakfire_string_set(mp->source, source);
- if (r < 0) {
+ if (r) {
ERROR(jail->pakfire, "Could not copy source: %m\n");
- return 1;
+ return r;
}
// Copy target
r = pakfire_string_set(mp->target, target);
- if (r < 0) {
+ if (r) {
ERROR(jail->pakfire, "Could not copy target: %m\n");
- return 1;
+ return r;
}
// Copy flags
// Make path
r = pakfire_string_format(path, "/proc/%d/uid_map", pid);
- if (r < 0)
- return 1;
+ if (r)
+ return r;
DEBUG(jail->pakfire, "Mapping UID range (%u - %lu)\n",
subuid->id, subuid->id + subuid->length);
// Make path
r = pakfire_string_format(path, "/proc/%d/gid_map", pid);
- if (r < 0)
- return 1;
+ if (r)
+ return r;
DEBUG(jail->pakfire, "Mapping GID range (%u - %lu)\n",
subgid->id, subgid->id + subgid->length);
// Make path
r = pakfire_string_format(path, "/proc/%d/setgroups", pid);
- if (r < 0)
- return 1;
+ if (r)
+ return r;
// Open file for writing
FILE* f = fopen(path, "w");
// Make path
int r = pakfire_string_format(path, "%s/%s.key", keystore_path, fpr);
- if (r < 0)
+ if (r)
return r;
// Create parent directory
// Make filename
r = pakfire_string_format(filename, "scriptlet/%s", type);
- if (r < 0)
+ if (r)
return r;
// Fetch scriptlet
// Make the package path
r = pakfire_string_format(path, "%s/%s", target, filename);
- if (r < 0)
+ if (r)
goto ERROR;
// Create the parent directory
// Create a temporary file in the target directory
r = pakfire_string_format(tmppath, "%s.XXXXXX", path);
- if (r < 0)
+ if (r)
goto ERROR;
// Create a temporary result file
continue;
// Catch any errors
- if (r < 0)
+ if (r)
goto ERROR;
}
static const char* pakfire_progressbar_counter(struct pakfire_progressbar* p,
struct pakfire_progressbar_widget* widget, unsigned int width, void* data) {
int r = pakfire_string_format(widget->buffer, "%lu/%lu", p->value, p->value_max);
- if (r < 0)
+ if (r)
return NULL;
return widget->buffer;
double percentage = p->value * 100.0 / p->value_max;
int r = pakfire_string_format(widget->buffer, "%3.0f%%", percentage);
- if (r < 0)
+ if (r)
return NULL;
return widget->buffer;
return NULL;
int r = pakfire_string_format(widget->buffer, "%02lu:%02lu", t / 60, t % 60);
- if (r < 0)
+ if (r)
return NULL;
return widget->buffer;
// Print a placeholder when we haven't started yet
if (p->value == 0) {
r = pakfire_string_format(widget->buffer, "%-5s: --:--:--", _("ETA"));
- if (r < 0)
+ if (r)
return NULL;
// Show total time when finished
} else if (p->status == PAKFIRE_PROGRESSBAR_FINISHED) {
r = pakfire_string_format(widget->buffer, "%-5s: %02lu:%02lu",
_("Time"), t / 60, t % 60);
- if (r < 0)
+ if (r)
return NULL;
// Calculate the ETA
r = pakfire_string_format(widget->buffer, "%-5s: %02lu:%02lu",
_("ETA"), eta / 60, eta % 60);
- if (r < 0)
+ if (r)
return NULL;
}
// Create path for a temporary database export file
r = pakfire_string_format(tmp, "%s/repodata/.pakfire-solv.XXXXXX", path);
- if (r < 0)
+ if (r)
return r;
// Create a temporary file to write to
// Make final database path
r = pakfire_string_format(database, "%s/repodata/%s", path, filename);
- if (r < 0) {
+ if (r) {
ERROR(repo->pakfire, "Could not join database path: %m\n");
goto ERROR;
}
// Make path to repomd.json
r = pakfire_string_format(repomd_path, "%s/repodata/repomd.json", path);
- if (r < 0)
+ if (r)
goto ERROR;
// Open repomd.json for writing
// Prefix path with file:// to form baseurl
r = pakfire_string_format(baseurl, "file://%s", path);
- if (r < 0)
+ if (r)
return 1;
// Create a new temporary repository at path
DEBUG(request->pakfire, "Locking running kernel %s\n", utsname.release);
r = pakfire_string_format(buffer, "kernel(%s)", utsname.release);
- if (r < 0)
+ if (r)
return;
Pool* pool = pakfire_get_solv_pool(request->pakfire);
char path[PATH_MAX];
char buffer[1024];
- r = pakfire_string_format(path, "%s/%s", TEST_SRC_PATH, file);
- ASSERT(r >= 0);
+ ASSERT_SUCCESS(pakfire_string_format(path, "%s/%s", TEST_SRC_PATH, file));
// Open file
ASSERT(f = fopen(path, "r"));