From b031befc25ef0bcce64b73b51f60e2c00b6f30a1 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 11 Oct 2011 11:14:31 +0200 Subject: Revert "mountpoint: refactor exit path" This change is unnecessary, we can use libmount stuff for everything. This reverts commit b16b56ec55507b6b83e0d35e3cefeb16367f3363. --- sys-utils/mountpoint.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'sys-utils/mountpoint.c') diff --git a/sys-utils/mountpoint.c b/sys-utils/mountpoint.c index 16c7c2271..1182f7c3b 100644 --- a/sys-utils/mountpoint.c +++ b/sys-utils/mountpoint.c @@ -116,7 +116,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out) int main(int argc, char **argv) { - int c, fs_devno = 0, dev_devno = 0, rc = EXIT_FAILURE; + int c, fs_devno = 0, dev_devno = 0, rc = 0; char *spec; struct stat st; @@ -162,36 +162,30 @@ int main(int argc, char **argv) if (stat(spec, &st)) { if (!quiet) - warn("%s", spec); - goto finish; + err(EXIT_FAILURE, "%s", spec); + return EXIT_FAILURE; } - - if (dev_devno) { - if (print_devno(spec, &st) == 0) - rc = EXIT_SUCCESS; - } else { + if (dev_devno) + rc = print_devno(spec, &st); + else { dev_t src; if (!S_ISDIR(st.st_mode)) { if (!quiet) - warnx(_("%s: not a directory"), spec); - goto finish; + errx(EXIT_FAILURE, _("%s: not a directory"), spec); + return EXIT_FAILURE; } src = dir_to_device(spec); if (!src) { if (!quiet) printf(_("%s is not a mountpoint\n"), spec); - goto finish; + return EXIT_FAILURE; } - - rc = EXIT_SUCCESS; - if (fs_devno) printf("%u:%u\n", major(src), minor(src)); else if (!quiet) printf(_("%s is a mountpoint\n"), spec); } -finish: - return rc; + return rc ? EXIT_FAILURE : EXIT_SUCCESS; } -- cgit v1.2.3-55-g7522