summaryrefslogtreecommitdiffstats
path: root/misc-utils/findmnt.c
diff options
context:
space:
mode:
authorKarel Zak2010-11-23 00:26:49 +0100
committerKarel Zak2011-01-03 12:28:46 +0100
commit932d154c8d8adeb1acf23d7a637fc7c18dd29d83 (patch)
treea40ae10a62725360d3995d930b4398c0de72205e /misc-utils/findmnt.c
parentfindmnt: use new tab parsing API (diff)
downloadkernel-qcow2-util-linux-932d154c8d8adeb1acf23d7a637fc7c18dd29d83.tar.gz
kernel-qcow2-util-linux-932d154c8d8adeb1acf23d7a637fc7c18dd29d83.tar.xz
kernel-qcow2-util-linux-932d154c8d8adeb1acf23d7a637fc7c18dd29d83.zip
findmnt: fix exit code
... returns 1 if nothing printed. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/findmnt.c')
-rw-r--r--misc-utils/findmnt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index c1b80dc8c..99af97836 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -499,7 +499,7 @@ int main(int argc, char *argv[])
struct tt *tt = NULL;
int tt_flags = 0;
- int i, c, rc = EXIT_FAILURE;
+ int i, c, nlines = 0, rc = EXIT_FAILURE;
struct option longopts[] = {
{ "ascii", 0, 0, 'a' },
@@ -720,6 +720,7 @@ int main(int argc, char *argv[])
while((fs = get_next_fs(tb, itr))) {
if (!add_line(tt, fs, NULL))
goto leave;
+ nlines++;
if (flags & FL_FIRSTONLY)
break;
}
@@ -729,7 +730,9 @@ int main(int argc, char *argv[])
* Print the output table
*/
tt_print_table(tt);
- rc = EXIT_SUCCESS;
+
+ if (is_listall_mode() || nlines)
+ rc = EXIT_SUCCESS;
leave:
tt_free_table(tt);