From 2d0bcf1e0266cf19b7c2bcde1a13e61d79d3df89 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 26 Mar 2025 11:20:12 -0400 Subject: [PATCH] =?utf8?q?coredump:=20rename=20fix=5Fpermissions()=20?= =?utf8?q?=E2=86=92=20fix=5Fpermissions=5Fand=5Flink()?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The function doesn't just adjust permissions, it actually moves the file into place. The function name should really make this fundamental fact clear. --- src/coredump/coredump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index 0c81922e077..3086f092878 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -304,7 +304,7 @@ static const char *coredump_tmpfile_name(const char *s) { return s ?: "(unnamed temporary file)"; } -static int fix_permissions( +static int fix_permissions_and_link( int fd, const char *filename, const char *target, @@ -595,7 +595,7 @@ static int save_external_coredump( uncompressed_size += partial_uncompressed_size; } - r = fix_permissions(fd_compressed, tmp_compressed, fn_compressed, context, allow_user); + r = fix_permissions_and_link(fd_compressed, tmp_compressed, fn_compressed, context, allow_user); if (r < 0) return r; @@ -622,7 +622,7 @@ static int save_external_coredump( LOG_ITEM("SIZE_LIMIT=%"PRIu64, max_size), LOG_MESSAGE_ID(SD_MESSAGE_TRUNCATED_CORE_STR)); - r = fix_permissions(fd, tmp, fn, context, allow_user); + r = fix_permissions_and_link(fd, tmp, fn, context, allow_user); if (r < 0) return log_error_errno(r, "Failed to fix permissions and finalize coredump %s into %s: %m", coredump_tmpfile_name(tmp), fn); -- 2.47.3