}
PAKFIRE_EXPORT int pakfire_file_set_path(struct pakfire_file* file, const char* path) {
- int r;
+ int r = 1;
// Check if path is set and absolute
if (!path || *path != '/') {
errno = EINVAL;
- return 1;
+ goto ERROR;
}
// Store path
r = pakfire_string_set(file->path, path);
if (r)
- return r;
+ goto ERROR;
// Set abspath if it isn't set, yet
if (!*file->abspath) {
- r = pakfire_path(file->pakfire, file->abspath, "%s", path);
+ r = pakfire_file_set_abspath(file, path);
if (r)
- return r;
+ goto ERROR;
}
return r;
+
+ERROR:
+ ERROR(file->pakfire, "Could not set path '%s': %m\n", path);
+ return r;
}
PAKFIRE_EXPORT const char* pakfire_file_get_hardlink(struct pakfire_file* file) {