diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-01-09 02:53:20 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-01-09 02:57:50 +0100 |
commit | da8f9c4661397db8b125e8c843d861430f265e71 (patch) | |
tree | 9cea545377c652fdbd7cf40bc533435c463fd060 /src/tmpfiles/offline-passwd.c | |
parent | tmpfile: fix resource leak (diff) | |
download | systemd-da8f9c4661397db8b125e8c843d861430f265e71.tar.xz systemd-da8f9c4661397db8b125e8c843d861430f265e71.zip |
tmpfile: make failure in path_extract_filename() non-critical
Diffstat (limited to 'src/tmpfiles/offline-passwd.c')
-rw-r--r-- | src/tmpfiles/offline-passwd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tmpfiles/offline-passwd.c b/src/tmpfiles/offline-passwd.c index 085286e992..fe866f8ca1 100644 --- a/src/tmpfiles/offline-passwd.c +++ b/src/tmpfiles/offline-passwd.c @@ -9,10 +9,9 @@ DEFINE_PRIVATE_HASH_OPS_WITH_KEY_DESTRUCTOR(uid_gid_hash_ops, char, string_hash_func, string_compare_func, free); static int open_passwd_file(const char *root, const char *fname, FILE **ret_file) { - _cleanup_free_ char *p = NULL, *bn = NULL; + _cleanup_free_ char *p = NULL; _cleanup_close_ int fd = -EBADF; _cleanup_fclose_ FILE *f = NULL; - int r; fd = chase_symlinks_and_open(fname, root, CHASE_PREFIX_ROOT, O_RDONLY|O_CLOEXEC, &p); if (fd < 0) @@ -24,11 +23,12 @@ static int open_passwd_file(const char *root, const char *fname, FILE **ret_file TAKE_FD(fd); - r = path_extract_filename(fname, &bn); - if (r < 0) - return r; + if (DEBUG_LOGGING) { + _cleanup_free_ char *bn = NULL; - log_debug("Reading %s entries from %s...", bn, p); + (void) path_extract_filename(fname, &bn); + log_debug("Reading %s entries from %s...", strna(bn), p); + } *ret_file = TAKE_PTR(f); return 0; |