commit
04f087ec didn't take into consideration that mnt_fs_get_target()
could return an error, and would therefore show false positives, such
as:
$ mkdir foo; mountpoint foo
foo is a mountpoint
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
struct libmnt_table *tb = mnt_new_table_from_file("/proc/self/mountinfo");
struct libmnt_fs *fs;
struct libmnt_cache *cache;
+ int rc = -1;
if (!tb) {
/*
mnt_table_set_cache(tb, cache);
fs = mnt_table_find_target(tb, spec, MNT_ITER_BACKWARD);
- if (fs && mnt_fs_get_target(fs))
+ if (fs && mnt_fs_get_target(fs)) {
*dev = mnt_fs_get_devno(fs);
+ rc = 0;
+ }
mnt_free_table(tb);
mnt_free_cache(cache);
- return 0;
+ return rc;
}
static int print_devno(const char *devname, struct stat *st)