fstools: use EXIT_FAILURE when indicating error on exit
authorMichael Heimpold <mhei@heimpold.de>
Sat, 24 Nov 2018 09:22:44 +0000 (10:22 +0100)
committerJohn Crispin <john@phrozen.org>
Mon, 26 Nov 2018 08:46:01 +0000 (09:46 +0100)
According to man page, using the EXIT_* macros is more portable than using
plain integer values.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
block.c
blockd.c

diff --git a/block.c b/block.c
index 07719a3ca621b8b832a16d4923670040924f5356..b01a63307a360b729c399186d3524a09a6574630 100644 (file)
--- a/block.c
+++ b/block.c
@@ -742,16 +742,16 @@ static void check_filesystem(struct probe_info *pr)
        if (!pid) {
                if(!strncmp(pr->type, "f2fs", 4)) {
                        execl(ckfs, ckfs, "-f", pr->dev, NULL);
-                       exit(-1);
+                       exit(EXIT_FAILURE);
                } else if(!strncmp(pr->type, "btrfs", 5)) {
                        execl(ckfs, ckfs, "--repair", pr->dev, NULL);
-                       exit(-1);
+                       exit(EXIT_FAILURE);
                } else if(!strncmp(pr->type, "ntfs", 4)) {
                        execl(ckfs, ckfs, "-b", pr->dev, NULL);
-                       exit(-1);
+                       exit(EXIT_FAILURE);
                } else {
                        execl(ckfs, ckfs, "-p", pr->dev, NULL);
-                       exit(-1);
+                       exit(EXIT_FAILURE);
                }
        } else if (pid > 0) {
                int status;
index 3af5390858ace9b15ecc26a5c33fb409c59fe591..a5da32c49d24725c1e163d178524f1914cda0abc 100644 (file)
--- a/blockd.c
+++ b/blockd.c
@@ -95,7 +95,7 @@ block(char *cmd, char *action, char *device)
                argv[a++] = device;
                execvp(argv[0], argv);
                ULOG_ERR("failed to spawn %s %s %s\n", *argv, action, device);
-               exit(-1);
+               exit(EXIT_FAILURE);
 
        default:
                waitpid(pid, &status, 0);
@@ -422,7 +422,7 @@ static int autofs_mount(void)
        if (kproto_version != 5) {
                ULOG_ERR("only kernel protocol version 5 is tested. You have %d.\n",
                        kproto_version);
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        if (ioctl(fd_autofs_write, AUTOFS_IOC_SETTIMEOUT, &autofs_timeout))
                ULOG_ERR("failed to set autofs timeout\n");