]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: fix syntax-check issues in previous tty commit
authorPádraig Brady <P@draigBrady.com>
Wed, 5 Apr 2017 23:18:11 +0000 (16:18 -0700)
committerPádraig Brady <P@draigBrady.com>
Wed, 5 Apr 2017 23:19:04 +0000 (16:19 -0700)
* src/tty.c: Avoid EXIT_FAILURE to be more descriptive
and to placate sc_some_programs_must_avoid_exit_failure.

src/tty.c

index e908e7ec115cd02742cc277ecd2545f5b32c8c32..e84c35367eaa21556574a5de53efebec72490293 100644 (file)
--- a/src/tty.c
+++ b/src/tty.c
@@ -16,8 +16,8 @@
 
 /* Displays "not a tty" if stdin is not a terminal.
    Displays nothing if -s option is given.
-   Exit status 0 if stdin is a tty, 1 if not, 2 if usage error,
-   3 if write error.
+   Exit status 0 if stdin is a tty, 1 if not a tty, 2 if usage error,
+   3 if write error, 4 for other stdin errors.
 
    Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */
 
@@ -33,6 +33,7 @@
 /* Exit statuses.  */
 enum
   {
+    TTY_STDIN_NOTTY = 1,
     TTY_FAILURE = 2,
     TTY_WRITE_ERROR = 3,
     TTY_STDIN_ERROR = 4
@@ -118,7 +119,7 @@ main (int argc, char **argv)
 
   if (silent)
     return (isatty (STDIN_FILENO) ? EXIT_SUCCESS
-            : errno == ENOTTY ? EXIT_FAILURE
+            : errno == ENOTTY ? TTY_STDIN_NOTTY
             : TTY_STDIN_ERROR);
 
   int status = EXIT_SUCCESS;
@@ -129,7 +130,7 @@ main (int argc, char **argv)
       if (errno != ENOTTY)
         error (TTY_STDIN_ERROR, errno, _("standard input"));
       tty = _("not a tty");
-      status = EXIT_FAILURE;
+      status = TTY_STDIN_NOTTY;
     }
 
   puts (tty);