From patchwork Mon Sep 8 06:45:29 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 203 Return-Path: X-Original-To: patchwork@ozlabs.org Delivered-To: patchwork@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5AB6ADDE1E for ; Mon, 8 Sep 2008 16:45:48 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1KcaVB-0004Hm-Tr; Mon, 08 Sep 2008 06:45:33 +0000 Received: from relay03.pair.com ([209.68.5.17]) by bombadil.infradead.org with smtp (Exim 4.68 #1 (Red Hat Linux)) id 1KcaVA-00043D-2g for linux-mtd@lists.infradead.org; Mon, 08 Sep 2008 06:45:32 +0000 Received: (qmail 70648 invoked by uid 0); 8 Sep 2008 06:45:30 -0000 Received: from unknown (HELO localhost.localdomain) (unknown) by unknown with SMTP; 8 Sep 2008 06:45:30 -0000 X-pair-Authenticated: 66.134.71.115 From: Grant Erickson To: linux-mtd@lists.infradead.org Subject: [PATCH 2/6] [MTD-UTILS] nanddump: Utilize Standard Exit Mnemonics Date: Sun, 7 Sep 2008 23:45:29 -0700 Message-Id: <1220856329-22740-1-git-send-email-gerickson@nuovations.com> X-Mailer: git-send-email 1.6.0.1 Organization: Nuovation System Designs, LLC X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.68.5.17 listed in list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+patchwork=ozlabs.org@lists.infradead.org Replace main exit and return status codes with equivalent mnemonics. Signed-off-by: Grant Erickson diff --git a/nanddump.c b/nanddump.c index e35caf8..8c7175c 100644 --- a/nanddump.c +++ b/nanddump.c @@ -51,7 +51,7 @@ static void display_help (void) "-b --omitbad omit bad blocks from the dump\n" "-p --prettyprint print nice (hexdump)\n" "-s addr --startaddress=addr start address\n"); - exit(0); + exit(EXIT_SUCCESS); } static void display_version (void) @@ -64,7 +64,7 @@ static void display_version (void) "You may redistribute copies of " PROGRAM "\n" "under the terms of the GNU General Public Licence.\n" "See the file `COPYING' for more information.\n"); - exit(0); + exit(EXIT_SUCCESS); } // Option variables @@ -126,7 +126,7 @@ static void process_options (int argc, char * const argv[]) case 'f': if (!(dumpfile = strdup(optarg))) { perror("stddup"); - exit(1); + exit(EXIT_FAILURE); } break; case 'i': @@ -183,14 +183,14 @@ int main(int argc, char * const argv[]) /* Open MTD device */ if ((fd = open(mtddev, O_RDONLY)) == -1) { perror("open flash"); - exit (1); + exit (EXIT_FAILURE); } /* Fill in MTD device capability structure */ if (ioctl(fd, MEMGETINFO, &meminfo) != 0) { perror("MEMGETINFO"); close(fd); - exit (1); + exit (EXIT_FAILURE); } /* Make sure device page sizes are valid */ @@ -201,7 +201,7 @@ int main(int argc, char * const argv[]) !(meminfo.oobsize == 8 && meminfo.writesize == 256)) { fprintf(stderr, "Unknown flash (not normal NAND)\n"); close(fd); - exit(1); + exit(EXIT_FAILURE); } /* Read the real oob length */ oob.length = meminfo.oobsize; @@ -216,19 +216,19 @@ int main(int argc, char * const argv[]) if (ioctl (fd, MEMGETOOBSEL, &old_oobinfo) != 0) { perror ("MEMGETOOBSEL"); close (fd); - exit (1); + exit (EXIT_FAILURE); } if (ioctl (fd, MEMSETOOBSEL, &none_oobinfo) != 0) { perror ("MEMSETOOBSEL"); close (fd); - exit (1); + exit (EXIT_FAILURE); } oobinfochanged = 1; break; default: perror ("MTDFILEMODE"); close (fd); - exit (1); + exit (EXIT_FAILURE); } } } else { @@ -251,7 +251,7 @@ int main(int argc, char * const argv[]) } else if ((ofd = open(dumpfile, O_WRONLY | O_TRUNC | O_CREAT, 0644))== -1) { perror ("open outfile"); close(fd); - exit(1); + exit(EXIT_FAILURE); } /* Initialize start/end addresses and block size */ @@ -379,7 +379,7 @@ int main(int argc, char * const argv[]) perror ("MEMSETOOBSEL"); close(fd); close(ofd); - return 1; + return EXIT_FAILURE; } } /* Close the output file and MTD device */ @@ -387,7 +387,7 @@ int main(int argc, char * const argv[]) close(ofd); /* Exit happy */ - return 0; + return EXIT_SUCCESS; closeall: /* The new mode change is per file descriptor ! */ @@ -398,5 +398,5 @@ closeall: } close(fd); close(ofd); - exit(1); + exit(EXIT_FAILURE); }