Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
int pakfire_file_set_abspath(struct pakfire_file* file, const char* path) {
// Check if path is set and absolute
- if (!path || *path != '/') {
- errno = EINVAL;
- return 1;
- }
+ if (!path || *path != '/')
+ return -EINVAL;
// Store the abspath
archive_entry_copy_sourcepath(file->entry, path);
char buffer[PATH_MAX];
int r = 0;
+ // Check input
+ if (!path)
+ return -EINVAL;
+
// Strip any leading dots from paths
if (pakfire_string_startswith(path, "./"))
path++;
ASSERT_SUCCESS(pakfire_file_create(&file, t->pakfire));
// Set path
- ASSERT_ERRNO(pakfire_file_set_path(file, NULL), EINVAL);
+ ASSERT(pakfire_file_set_path(file, NULL) == -EINVAL);
// It should not be possible to set relative absolute paths
- ASSERT_ERRNO(pakfire_file_set_abspath(file, "abc/abc"), EINVAL);
+ ASSERT(pakfire_file_set_abspath(file, "abc/abc") == -EINVAL);
// Destroy it
ASSERT_NULL(pakfire_file_unref(file));