]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: make use of fd_get_path() where appropriate
authorLennart Poettering <lennart@poettering.net>
Mon, 26 Mar 2018 11:27:26 +0000 (13:27 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 28 Mar 2018 20:04:58 +0000 (22:04 +0200)
src/journal/journald-native.c

index cee873215d5ddc9076fb4cabd3fd24925228462c..6b429bc2c7581caa3e2525033dc13a63db82ec7c 100644 (file)
@@ -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;
                 }