diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-10-24 10:33:20 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-10-24 15:44:24 +0200 |
commit | a5648b809457d120500b2acb18b31e2168a4817a (patch) | |
tree | 59846b7791dce151e858a889f1281bad28c55ffe /src/machine | |
parent | test-socket-util: avoid writing past the defined buffer (diff) | |
download | systemd-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/machine')
-rw-r--r-- | src/machine/machine-dbus.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c index 0d58b5eb8b..c2747112d4 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c @@ -846,7 +846,7 @@ int bus_machine_method_bind_mount(sd_bus_message *message, void *userdata, sd_bu if (laccess(p, F_OK) < 0) return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Container does not allow propagation of mount points."); - r = chase_symlinks(src, NULL, CHASE_TRAIL_SLASH, &chased_src); + r = chase_symlinks(src, NULL, CHASE_TRAIL_SLASH, &chased_src, NULL); if (r < 0) return sd_bus_error_set_errnof(error, r, "Failed to resolve source path: %m"); |