]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fs-util: use strna() on returned strings of fd_get_path() if we don't check its retur...
authorLennart Poettering <lennart@poettering.net>
Wed, 23 Sep 2020 16:18:03 +0000 (18:18 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 23 Sep 2020 16:20:38 +0000 (18:20 +0200)
Let's make sure to use strna() on the strings returned by fd_get_path()
where we knowingly ignore any failures. We got this right in most cases,
but two were missing.

src/basic/fs-util.c

index 477848f2a0aae5ca7bb6cd700ab302925d668721..fb74501105656de29248d0cdfb2085856a05c4c2 100644 (file)
@@ -765,7 +765,7 @@ static int log_unsafe_transition(int a, int b, const char *path, unsigned flags)
 
         return log_warning_errno(SYNTHETIC_ERRNO(ENOLINK),
                                  "Detected unsafe path transition %s %s %s during canonicalization of %s.",
-                                 n1, special_glyph(SPECIAL_GLYPH_ARROW), n2, path);
+                                 strna(n1), special_glyph(SPECIAL_GLYPH_ARROW), strna(n2), path);
 }
 
 static int log_autofs_mount_point(int fd, const char *path, unsigned flags) {
@@ -778,7 +778,7 @@ static int log_autofs_mount_point(int fd, const char *path, unsigned flags) {
 
         return log_warning_errno(SYNTHETIC_ERRNO(EREMOTE),
                                  "Detected autofs mount point %s during canonicalization of %s.",
-                                 n1, path);
+                                 strna(n1), path);
 }
 
 int chase_symlinks(const char *path, const char *original_root, unsigned flags, char **ret_path, int *ret_fd) {