// Compose the absolute path
r = pakfire_path_join(path, ROOT, cgroup->path);
- if (r < 0)
+ if (r)
return 1;
// Try creating the directory
// Join paths
r = pakfire_path_join(path, cgroup->path, name);
- if (r < 0)
+ if (r)
return 1;
// Open the child group
if (*data->prefix) {
// Compose file path
r = pakfire_path_join(buffer, data->prefix, path);
- if (r < 0) {
+ if (r) {
ERROR(pakfire, "Could not compose file path: %m\n");
return r;
}
const char* link = archive_entry_hardlink(entry);
if (link) {
r = pakfire_path_join(buffer, data->prefix, link);
- if (r < 0) {
+ if (r) {
ERROR(pakfire, "Could not compose hardlink path: %m\n");
return r;
}
int __pakfire_unhexlify(unsigned char* dst, const size_t l, const char* src);
#define pakfire_path_join(dest, first, second) \
- __pakfire_path_join(dest, sizeof(dest) - 1, first, second)
-
-int __pakfire_path_join(char* dest, size_t length,
+ __pakfire_path_join(dest, sizeof(dest), first, second)
+int __pakfire_path_join(char* dest, const size_t length,
const char* first, const char* second);
const char* pakfire_path_relpath(const char* root, const char* path);
// Write the scriptlet to disk
r = pakfire_path_join(path, root, "pakfire-script.XXXXXX");
- if (r < 0)
+ if (r)
goto ERROR;
// Open a temporary file
for (const struct pakfire_mountpoint* mp = mountpoints; mp->source; mp++) {
// Figure out where to mount
r = pakfire_path_join(target, root, mp->target);
- if (r < 0)
+ if (r)
return r;
// Create target
// Make new path
r = pakfire_path_join(destination_path, path, filename);
- if (r < 0)
+ if (r)
goto OUT;
// Copying archive to destination
return s;
}
-int __pakfire_path_join(char* dest, size_t length,
+int __pakfire_path_join(char* dest, const size_t length,
const char* first, const char* second) {
if (!first)
- return snprintf(dest, length, "%s", second);
+ return __pakfire_string_format(dest, length, "%s", second);
if (!second)
- return snprintf(dest, length, "%s", first);
+ return __pakfire_string_format(dest, length, "%s", first);
// Remove leading slashes from second argument
while (*second == '/')
second++;
- return snprintf(dest, length, "%s/%s", first, second);
+ return __pakfire_string_format(dest, length, "%s/%s", first, second);
}
const char* pakfire_path_relpath(const char* root, const char* path) {