From 77c9bb177aaed9395770c5bacf790b4c41bb3999 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Fri, 7 Apr 2023 03:55:39 +0800 Subject: [PATCH] edit-util: improve log messages --- src/shared/edit-util.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c index f482c2ac8b..9fd74973aa 100644 --- a/src/shared/edit-util.c +++ b/src/shared/edit-util.c @@ -292,7 +292,7 @@ static int strip_edit_temp_file(EditFile *e) { r = read_full_file(e->temp, &old_contents, NULL); if (r < 0) - return log_error_errno(r, "Failed to read temporary file \"%s\": %m", e->temp); + return log_error_errno(r, "Failed to read temporary file '%s': %m", e->temp); if (e->context->marker_start) { /* Trim out the lines between the two markers */ @@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) { r = write_string_file(e->temp, new_contents, WRITE_STRING_FILE_CREATE | WRITE_STRING_FILE_TRUNCATE | WRITE_STRING_FILE_AVOID_NEWLINE); if (r < 0) - return log_error_errno(r, "Failed to modify temporary file \"%s\": %m", e->temp); + return log_error_errno(r, "Failed to strip temporary file '%s': %m", e->temp); return 1; /* Contents have real changes and are changed after stripping */ } @@ -359,7 +359,10 @@ int do_edit_files_and_install(EditFileContext *context) { r = RET_NERRNO(rename(i->temp, i->path)); if (r < 0) - return log_error_errno(r, "Failed to rename \"%s\" to \"%s\": %m", i->temp, i->path); + return log_error_errno(r, + "Failed to rename temporary file '%s' to target file '%s': %m", + i->temp, + i->path); i->temp = mfree(i->temp); log_info("Successfully installed edited file '%s'.", i->path); -- 2.25.1