summaryrefslogtreecommitdiff
path: root/src/shared/mount-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-03-25 16:54:48 +0100
committerLennart Poettering <lennart@poettering.net>2019-03-25 19:33:55 +0100
commitf8b1904f9611a7c7518ab31a06a6b7961ca97c6a (patch)
tree877a4ac41bc70f21edec6dd5595b927e0d0ef985 /src/shared/mount-util.c
parent867189b5456850a55e876ba31922aeb2568d786f (diff)
downloadsystemd-f8b1904f9611a7c7518ab31a06a6b7961ca97c6a.tar.gz
systemd-f8b1904f9611a7c7518ab31a06a6b7961ca97c6a.tar.bz2
systemd-f8b1904f9611a7c7518ab31a06a6b7961ca97c6a.zip
mount-util: don't clobber return value in umount_recursive()
We shouldn't override 'r' with the result of cunescape(), since we use it to return the last error of umount().
Diffstat (limited to 'src/shared/mount-util.c')
-rw-r--r--src/shared/mount-util.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c
index 9fa995f693..8af90a5e31 100644
--- a/src/shared/mount-util.c
+++ b/src/shared/mount-util.c
@@ -29,8 +29,8 @@
#include "strv.h"
int umount_recursive(const char *prefix, int flags) {
- bool again;
int n = 0, r;
+ bool again;
/* Try to umount everything recursively below a
* directory. Also, take care of stacked mounts, and keep
@@ -73,9 +73,9 @@ int umount_recursive(const char *prefix, int flags) {
continue;
}
- r = cunescape(path, UNESCAPE_RELAX, &p);
- if (r < 0)
- return r;
+ k = cunescape(path, UNESCAPE_RELAX, &p);
+ if (k < 0)
+ return k;
if (!path_startswith(p, prefix))
continue;
@@ -95,7 +95,7 @@ int umount_recursive(const char *prefix, int flags) {
} while (again);
- return r ? r : n;
+ return r < 0 ? r : n;
}
static int get_mount_flags(const char *path, unsigned long *flags) {