From: Lennart Poettering Date: Mon, 26 Mar 2018 11:27:26 +0000 (+0200) Subject: journald: make use of fd_get_path() where appropriate X-Git-Tag: v239~457^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf852ff63b70537bf0e72654381694c6aee97f77;p=thirdparty%2Fsystemd.git journald: make use of fd_get_path() where appropriate --- 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; }