* [PATCH 1/2] btrfs-progs: return non zero when label is not found
@ 2014-01-14 11:17 Anand Jain
2014-01-14 11:17 ` [PATCH 2/2] btrfs-progs: mid flight return leaks memory during filesystem show mnt Anand Jain
0 siblings, 1 reply; 2+ messages in thread
From: Anand Jain @ 2014-01-14 11:17 UTC (permalink / raw)
To: linux-btrfs
btrfs filesystem show <not-found-label> should return non zero
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
cmds-filesystem.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index c50a65f..ee6cc84 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -612,6 +612,7 @@ static int cmd_show(int argc, char **argv)
char path[PATH_MAX];
__u8 fsid[BTRFS_FSID_SIZE];
char uuid_buf[37];
+ int found = 0;
while (1) {
int long_index;
@@ -694,8 +695,10 @@ static int cmd_show(int argc, char **argv)
ret = btrfs_scan_kernel_v2(search);
if (ret == -ENOTTY)
ret = btrfs_scan_kernel(search);
- if (search && !ret)
- return 0;
+ if (search && !ret) {
+ /* since search is found we are done */
+ goto out;
+ }
/* shows mounted only */
if (where == BTRFS_SCAN_MOUNTED)
@@ -717,12 +720,15 @@ devs_only:
continue;
print_one_uuid(fs_devices);
+ found = 1;
}
+ if (search && !found)
+ ret = 1;
out:
printf("%s\n", BTRFS_BUILD_VERSION);
free_seen_fsid();
- return 0;
+ return ret;
}
static const char * const cmd_sync_usage[] = {
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH 2/2] btrfs-progs: mid flight return leaks memory during filesystem show mnt
2014-01-14 11:17 [PATCH 1/2] btrfs-progs: return non zero when label is not found Anand Jain
@ 2014-01-14 11:17 ` Anand Jain
0 siblings, 0 replies; 2+ messages in thread
From: Anand Jain @ 2014-01-14 11:17 UTC (permalink / raw)
To: linux-btrfs
since now handle_print()->print_one_fs() calls add_seen_fsid()
the thread has to go through free_seen_fsid()
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
cmds-filesystem.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index ee6cc84..d38fae6 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -681,10 +681,11 @@ static int cmd_show(int argc, char **argv)
}
} else if (type == BTRFS_ARG_MNTPOINT) {
char label[BTRFS_LABEL_SIZE];
- if (get_label_mounted(search, label))
+ ret = get_label_mounted(search, label);
+ if (ret)
return 1;
handle_print(search, label);
- return 0;
+ goto out;
}
}
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-14 11:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-14 11:17 [PATCH 1/2] btrfs-progs: return non zero when label is not found Anand Jain
2014-01-14 11:17 ` [PATCH 2/2] btrfs-progs: mid flight return leaks memory during filesystem show mnt Anand Jain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox