From cf852ff63b70537bf0e72654381694c6aee97f77 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 26 Mar 2018 13:27:26 +0200 Subject: [PATCH] journald: make use of fd_get_path() where appropriate --- src/journal/journald-native.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index cee873215d5..6b429bc2c75 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -343,20 +343,15 @@ void server_process_native_file( sealed = memfd_get_sealed(fd) > 0; if (!sealed && (!ucred || ucred->uid != 0)) { - _cleanup_free_ char *sl = NULL, *k = NULL; + _cleanup_free_ char *k = NULL; const char *e; /* If this is not a sealed memfd, and the peer is unknown or * unprivileged, then verify the path. */ - if (asprintf(&sl, "/proc/self/fd/%i", fd) < 0) { - log_oom(); - return; - } - - r = readlink_malloc(sl, &k); + r = fd_get_path(fd, &k); if (r < 0) { - log_error_errno(r, "readlink(%s) failed: %m", sl); + log_error_errno(r, "readlink(/proc/self/fd/%i) failed: %m", fd); return; } -- 2.47.3