]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
yes.c: do not use exit after error
authorMarek Polacek <mpolacek@redhat.com>
Fri, 27 May 2011 07:25:11 +0000 (09:25 +0200)
committerEric Blake <eblake@redhat.com>
Wed, 1 Jun 2011 14:05:29 +0000 (08:05 -0600)
I think it would be better to exit through the error() and not
to call the exit() after the error().  This way we can get rid of
one function call (and curly brackets).

* src/yes.c (main): Exit through the error(), remove exit() call
after error().

src/yes.c

index 25b1679a70707ac388b6cade0351ede5008372ea..18b5c534223aaf6557a88330afd0e33827d92763 100644 (file)
--- a/src/yes.c
+++ b/src/yes.c
@@ -84,9 +84,6 @@ main (int argc, char **argv)
       for (i = optind; i < argc; i++)
         if (fputs (argv[i], stdout) == EOF
             || putchar (i == argc - 1 ? '\n' : ' ') == EOF)
-          {
-            error (0, errno, _("standard output"));
-            exit (EXIT_FAILURE);
-          }
+          error (EXIT_FAILURE, errno, _("standard output"));
     }
 }