]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
import: prefer fd_get_path() over readlink_malloc() where applicable
authorLennart Poettering <lennart@poettering.net>
Wed, 10 Oct 2018 15:44:43 +0000 (17:44 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 26 Nov 2018 17:09:01 +0000 (18:09 +0100)
src/import/export.c
src/import/import.c

index f81485bbc7db4b5093a403e91b18752ee48743d3..490710678f7a54fd75e28a37034e4adf293ca801 100644 (file)
@@ -95,7 +95,7 @@ static int export_tar(int argc, char *argv[], void *userdata) {
 
                 fd = STDOUT_FILENO;
 
-                (void) readlink_malloc("/proc/self/fd/1", &pretty);
+                (void) fd_get_path(fd, &pretty);
                 log_info("Exporting '%s', saving to '%s' with compression '%s'.", local, strna(pretty), import_compress_type_to_string(arg_compress));
         }
 
@@ -172,7 +172,7 @@ static int export_raw(int argc, char *argv[], void *userdata) {
 
                 fd = STDOUT_FILENO;
 
-                (void) readlink_malloc("/proc/self/fd/1", &pretty);
+                (void) fd_get_path(fd, &pretty);
                 log_info("Exporting '%s', saving to '%s' with compression '%s'.", local, strna(pretty), import_compress_type_to_string(arg_compress));
         }
 
index 9dca2f3d415669425000d86fc3904953e0a2ad90..f34244acff2e71f81879cecf1f457204d7a49bb0 100644 (file)
@@ -96,7 +96,7 @@ static int import_tar(int argc, char *argv[], void *userdata) {
 
                 fd = STDIN_FILENO;
 
-                (void) readlink_malloc("/proc/self/fd/0", &pretty);
+                (void) fd_get_path(fd, &pretty);
                 log_info("Importing '%s', saving as '%s'.", strna(pretty), local);
         }
 
@@ -192,7 +192,7 @@ static int import_raw(int argc, char *argv[], void *userdata) {
 
                 fd = STDIN_FILENO;
 
-                (void) readlink_malloc("/proc/self/fd/0", &pretty);
+                (void) fd_get_path(fd, &pretty);
                 log_info("Importing '%s', saving as '%s'.", strempty(pretty), local);
         }