Signed-off-by: Karel Zak <kzak@redhat.com>
assert(cxt);
assert(cxt->filename);
- if (cxt->is_mounted)
+ if (cxt->is_mounted || cxt->is_swap)
return cxt->mountpoint;
if (!mtab) {
if (!fs)
fs = mnt_table_find_srcpath(mtab, cxt->filename, MNT_ITER_BACKWARD);
if (!fs) {
- cxt->mountpoint = is_active_swap(cxt->filename) ? xstrdup("[SWAP]") : NULL;
- cxt->is_mounted = 1;
+ if (is_active_swap(cxt->filename)) {
+ cxt->mountpoint = xstrdup("[SWAP]");
+ cxt->is_swap = 1;
+ } else
+ cxt->mountpoint = NULL;
+
return cxt->mountpoint;
}
if (!cxt->fsstat.f_blocks) {
mnt = lsblk_device_get_mountpoint(cxt);
- if (!mnt)
+ if (!mnt || cxt->is_swap)
return NULL;
if (statvfs(mnt, &cxt->fsstat) != 0)
return NULL;
uint64_t size; /* device size */
- unsigned int is_mounted : 1;
+ unsigned int is_mounted : 1,
+ is_swap : 1;
};
/* lsblk-mnt.c */