diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-10-24 10:33:20 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-10-24 10:33:20 +0200 |
commit | 7abeefa9f9e55592db14f3fdafc01ea8f90311e4 (patch) | |
tree | f91422895ffeda469dabd808cd4155d76638cc81 /src/shared/unit-file.c | |
parent | 235ecb6d75f00384b3f42f449c769340e13fbd0b (diff) | |
download | systemd-chase-symlinks-rework.tar.gz |
basic/fs-util: change CHASE_OPEN flag into a separate output parameterchase-symlinks-rework
chase_symlinks() would return negative on error, and either a non-negative status
or a non-negative fd when CHASE_OPEN was given. This made the interface quite
complicated, because dependning on the flags used, we would get two different
"types" of return object. Coverity was always confused by this, and flagged
every use of chase_symlinks() without CHASE_OPEN as a resource leak (because it
would this that an fd is returned). This patch uses a saparate output parameter,
so there is no confusion.
(I think it is OK to have functions which return either an error or an fd. It's
only returning *either* an fd or a non-fd that is confusing.)
Diffstat (limited to 'src/shared/unit-file.c')
-rw-r--r-- | src/shared/unit-file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/unit-file.c b/src/shared/unit-file.c index b015ff9338..28cd3c8600 100644 --- a/src/shared/unit-file.c +++ b/src/shared/unit-file.c @@ -303,7 +303,7 @@ int unit_file_build_name_map( } /* Get rid of "." and ".." components in target path */ - r = chase_symlinks(target, lp->root_dir, CHASE_NOFOLLOW | CHASE_NONEXISTENT, &simplified); + r = chase_symlinks(target, lp->root_dir, CHASE_NOFOLLOW | CHASE_NONEXISTENT, &simplified, NULL); if (r < 0) { log_warning_errno(r, "Failed to resolve symlink %s pointing to %s, ignoring: %m", filename, target); |