]> www.infradead.org Git - mtd-utils.git/commitdiff
Use defines for exit code values
authorDaniel Wagner <daniel.wagner@siemens.com>
Mon, 12 Jun 2017 10:50:43 +0000 (12:50 +0200)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Wed, 14 Jun 2017 08:53:15 +0000 (10:53 +0200)
Make the usage of exit consist. That is use the pre defined exit
values.

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
jffsX-utils/jffs2dump.c
jffsX-utils/mkfs.jffs2.c
misc-utils/flash_unlock.c
nand-utils/nandtest.c
nand-utils/nftl_format.c

index a8d082bf1e39a47ab18546b66d9a9d7a18ef5738..82f31970c7f50aad2b24d8f0a15c5b59dd530ba7 100644 (file)
@@ -751,7 +751,7 @@ int main(int argc, char **argv)
        /* Open the input file */
        if ((fd = open(img, O_RDONLY)) == -1) {
                perror("open input file");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        // get image length
@@ -762,7 +762,7 @@ int main(int argc, char **argv)
        if (!data) {
                perror("out of memory");
                close (fd);
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if (datsize && oobsize) {
@@ -796,5 +796,5 @@ int main(int argc, char **argv)
        free (data);
 
        // Return happy
-       exit (0);
+       exit (EXIT_SUCCESS);
 }
index ca5e0d560f98769db1fd8ac614b12bec04fe27da..88e6cab42133a8cfa5a655e83251322565cfe35a 100644 (file)
@@ -1052,7 +1052,7 @@ static void formalize_posix_acl(void *xvalue, int *value_len)
        if (offset > *value_len) {
                printf("Length of JFFS2 ACL expression(%u) is longer than general one(%u).\n",
                                offset, *value_len);
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        memcpy(xvalue, buffer, offset);
        *value_len = offset;
index 94f47611435501fb1038e9d34d0081020c800c99..5a3aac532053c75b018efaf440590e03b807cabd 100644 (file)
@@ -87,7 +87,7 @@ static void process_args(int argc, char *argv[])
 
                switch (c) {
                case 'h':
-                       usage(0);
+                       usage(EXIT_SUCCESS);
                        break;
                case 'i':
                        req = REQUEST_ISLOCKED;
@@ -105,14 +105,14 @@ static void process_args(int argc, char *argv[])
                        common_print_version();
                        exit(0);
                default:
-                       usage(1);
+                       usage(EXIT_FAILURE);
                        break;
                }
        }
 
        if (req_set > 1) {
                errmsg("cannot specify more than one lock/unlock/islocked option");
-               usage(1);
+               usage(EXIT_FAILURE);
        }
 
        arg_idx = optind;
@@ -120,10 +120,10 @@ static void process_args(int argc, char *argv[])
        /* Sanity checks */
        if (argc - arg_idx < 1) {
                errmsg("too few arguments");
-               usage(1);
+               usage(EXIT_FAILURE);
        } else if (argc - arg_idx > 3) {
                errmsg("too many arguments");
-               usage(1);
+               usage(EXIT_FAILURE);
        }
 
        /* First non-option argument */
index 56767337846b4acb35e929b2c7e153b77011ec9a..9e39446de2572aed9a0056118cc1604bfb15288f 100644 (file)
@@ -181,14 +181,14 @@ int main(int argc, char **argv)
 
                switch (c) {
                case 'h':
-                       usage(0);
+                       usage(EXIT_SUCCESS);
                        break;
                case 'V':
                        common_print_version();
                        exit(EXIT_SUCCESS);
                        break;
                case '?':
-                       usage(1);
+                       usage(EXIT_FAILURE);
                        break;
 
                case 'm':
@@ -222,7 +222,7 @@ int main(int argc, char **argv)
                }
        }
        if (argc - optind != 1)
-               usage(1);
+               usage(EXIT_FAILURE);
        if (error)
                errmsg_die("Try --help for more information");
 
index a329c59fc504bd6d1f9479d0c7d276e7d01b563e..ea8199d5509d2c6fb8114204ac1b41558ca5e8f4 100644 (file)
@@ -234,7 +234,7 @@ int main(int argc, char **argv)
        int idx = 0;
 
        if (argc < 2)
-               usage(1);
+               usage(EXIT_FAILURE);
 
        nftl = "NFTL";
 
@@ -249,13 +249,13 @@ int main(int argc, char **argv)
                                break;
                        case 'h':
                        case '?':
-                               usage(0);
+                               usage(EXIT_SUCCESS);
                                break;
                        case 'V':
                                display_version();
                                break;
                        default:
-                               usage(1);
+                               usage(EXIT_FAILURE);
                                break;
                }
        }