From 709f6e46a35ec492b70eb92943d82a8d838ce918 Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Thu, 5 Nov 2015 13:44:06 +0100 Subject: treewide: use the negative error codes returned by our functions Our functions return negative error codes. Do not rely on errno being set after calling our own functions. --- src/import/import-raw.c | 4 ++-- src/import/import-tar.c | 2 +- src/import/pull-raw.c | 6 +++--- src/import/pull-tar.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/import') diff --git a/src/import/import-raw.c b/src/import/import-raw.c index 2193d1d7f1..7593f064fc 100644 --- a/src/import/import-raw.c +++ b/src/import/import-raw.c @@ -199,7 +199,7 @@ static int raw_import_maybe_convert_qcow2(RawImport *i) { r = chattr_fd(converted_fd, FS_NOCOW_FL, FS_NOCOW_FL); if (r < 0) - log_warning_errno(errno, "Failed to set file attributes on %s: %m", t); + log_warning_errno(r, "Failed to set file attributes on %s: %m", t); log_info("Unpacking QCOW2 file."); @@ -287,7 +287,7 @@ static int raw_import_open_disk(RawImport *i) { r = chattr_fd(i->output_fd, FS_NOCOW_FL, FS_NOCOW_FL); if (r < 0) - log_warning_errno(errno, "Failed to set file attributes on %s: %m", i->temp_path); + log_warning_errno(r, "Failed to set file attributes on %s: %m", i->temp_path); return 0; } diff --git a/src/import/import-tar.c b/src/import/import-tar.c index 2ae1d88168..c7983c04be 100644 --- a/src/import/import-tar.c +++ b/src/import/import-tar.c @@ -241,7 +241,7 @@ static int tar_import_fork_tar(TarImport *i) { if (mkdir(i->temp_path, 0755) < 0) return log_error_errno(errno, "Failed to create directory %s: %m", i->temp_path); } else if (r < 0) - return log_error_errno(errno, "Failed to create subvolume %s: %m", i->temp_path); + return log_error_errno(r, "Failed to create subvolume %s: %m", i->temp_path); else (void) import_assign_pool_quota_and_warn(i->temp_path); diff --git a/src/import/pull-raw.c b/src/import/pull-raw.c index 394131680d..4c1787b682 100644 --- a/src/import/pull-raw.c +++ b/src/import/pull-raw.c @@ -244,7 +244,7 @@ static int raw_pull_maybe_convert_qcow2(RawPull *i) { r = chattr_fd(converted_fd, FS_NOCOW_FL, FS_NOCOW_FL); if (r < 0) - log_warning_errno(errno, "Failed to set file attributes on %s: %m", t); + log_warning_errno(r, "Failed to set file attributes on %s: %m", t); log_info("Unpacking QCOW2 file."); @@ -320,7 +320,7 @@ static int raw_pull_make_local_copy(RawPull *i) { * writes. */ r = chattr_fd(dfd, FS_NOCOW_FL, FS_NOCOW_FL); if (r < 0) - log_warning_errno(errno, "Failed to set file attributes on %s: %m", tp); + log_warning_errno(r, "Failed to set file attributes on %s: %m", tp); r = copy_bytes(i->raw_job->disk_fd, dfd, (uint64_t) -1, true); if (r < 0) { @@ -511,7 +511,7 @@ static int raw_pull_job_on_open_disk_raw(PullJob *j) { r = chattr_fd(j->disk_fd, FS_NOCOW_FL, FS_NOCOW_FL); if (r < 0) - log_warning_errno(errno, "Failed to set file attributes on %s: %m", i->temp_path); + log_warning_errno(r, "Failed to set file attributes on %s: %m", i->temp_path); return 0; } diff --git a/src/import/pull-tar.c b/src/import/pull-tar.c index 26c0bc5866..e7fcd293f1 100644 --- a/src/import/pull-tar.c +++ b/src/import/pull-tar.c @@ -416,7 +416,7 @@ static int tar_pull_job_on_open_disk_tar(PullJob *j) { if (mkdir(i->temp_path, 0755) < 0) return log_error_errno(errno, "Failed to create directory %s: %m", i->temp_path); } else if (r < 0) - return log_error_errno(errno, "Failed to create subvolume %s: %m", i->temp_path); + return log_error_errno(r, "Failed to create subvolume %s: %m", i->temp_path); else (void) import_assign_pool_quota_and_warn(i->temp_path); -- cgit v1.2.3-54-g00ecf