summaryrefslogtreecommitdiffstats
path: root/src/volatile-root
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-10-24 10:33:20 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-10-24 15:44:24 +0200
commita5648b809457d120500b2acb18b31e2168a4817a (patch)
tree59846b7791dce151e858a889f1281bad28c55ffe /src/volatile-root
parenttest-socket-util: avoid writing past the defined buffer (diff)
downloadsystemd-a5648b809457d120500b2acb18b31e2168a4817a.tar.xz
systemd-a5648b809457d120500b2acb18b31e2168a4817a.zip
basic/fs-util: change CHASE_OPEN flag into a separate output parameter
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/volatile-root')
-rw-r--r--src/volatile-root/volatile-root.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/volatile-root/volatile-root.c b/src/volatile-root/volatile-root.c
index d1193a7a24..af78a87d6f 100644
--- a/src/volatile-root/volatile-root.c
+++ b/src/volatile-root/volatile-root.c
@@ -21,7 +21,7 @@ static int make_volatile(const char *path) {
assert(path);
- r = chase_symlinks("/usr", path, CHASE_PREFIX_ROOT, &old_usr);
+ r = chase_symlinks("/usr", path, CHASE_PREFIX_ROOT, &old_usr, NULL);
if (r < 0)
return log_error_errno(r, "/usr not available in old root: %m");