We shouldn't override 'r' with the result of cunescape(), since we use
it to return the last error of umount().
#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
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;
} while (again);
- return r ? r : n;
+ return r < 0 ? r : n;
}
static int get_mount_flags(const char *path, unsigned long *flags) {