* src/system.h (EXIT_FAIL): Remove definition.
* src/chroot.c (main): EXIT_FAIL -> EXIT_FAILURE.
* src/env.c (main): Likewise.
* src/nice.c (main): Likewise.
* src/su.c (change_identity, main): Likewise.
* src/tty.c (main): Likewise.
Suggestion from Eric Blake.
+2007-08-29 Jim Meyering <jim@meyering.net>
+
+ Use EXIT_FAILURE, not EXIT_FAIL, now that EXIT_FAILURE is always 1.
+ * src/system.h (EXIT_FAIL): Remove definition.
+ * src/chroot.c (main): EXIT_FAIL -> EXIT_FAILURE.
+ * src/env.c (main): Likewise.
+ * src/nice.c (main): Likewise.
+ * src/su.c (change_identity, main): Likewise.
+ * src/tty.c (main): Likewise.
+ Suggestion from Eric Blake.
+
2007-08-28 Jim Meyering <jim@meyering.net>
* src/test.c (usage): Note that [ honors --help and --version,
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- initialize_exit_failure (EXIT_FAIL);
+ initialize_exit_failure (EXIT_FAILURE);
atexit (close_stdout);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
- usage (EXIT_FAIL);
+ usage (EXIT_FAILURE);
if (argc <= optind)
{
error (0, 0, _("missing operand"));
- usage (EXIT_FAIL);
+ usage (EXIT_FAILURE);
}
if (chroot (argv[optind]) != 0)
- error (EXIT_FAIL, errno, _("cannot change root directory to %s"), argv[1]);
+ error (EXIT_FAILURE, errno, _("cannot change root directory to %s"), argv[1]);
if (chdir ("/"))
- error (EXIT_FAIL, errno, _("cannot chdir to root directory"));
+ error (EXIT_FAILURE, errno, _("cannot chdir to root directory"));
if (argc == optind + 1)
{
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- initialize_exit_failure (EXIT_FAIL);
+ initialize_exit_failure (EXIT_FAILURE);
atexit (close_stdout);
while ((optc = getopt_long (argc, argv, "+iu:", longopts, NULL)) != -1)
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
- usage (EXIT_FAIL);
+ usage (EXIT_FAILURE);
}
}
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- initialize_exit_failure (EXIT_FAIL);
+ initialize_exit_failure (EXIT_FAILURE);
atexit (close_stdout);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
i += optind - 1;
if (optc == '?')
- usage (EXIT_FAIL);
+ usage (EXIT_FAILURE);
else if (optc == 'n')
adjustment_given = optarg;
else /* optc == -1 */
enum { MIN_ADJUSTMENT = 1 - 2 * NZERO, MAX_ADJUSTMENT = 2 * NZERO - 1 };
long int tmp;
if (LONGINT_OVERFLOW < xstrtol (adjustment_given, NULL, 10, &tmp, ""))
- error (EXIT_FAIL, 0, _("invalid adjustment %s"),
+ error (EXIT_FAILURE, 0, _("invalid adjustment %s"),
quote (adjustment_given));
adjustment = MAX (MIN_ADJUSTMENT, MIN (tmp, MAX_ADJUSTMENT));
}
if (adjustment_given)
{
error (0, 0, _("a command must be given with an adjustment"));
- usage (EXIT_FAIL);
+ usage (EXIT_FAILURE);
}
/* No command given; print the niceness. */
errno = 0;
current_niceness = GET_NICENESS ();
if (current_niceness == -1 && errno != 0)
- error (EXIT_FAIL, errno, _("cannot get niceness"));
+ error (EXIT_FAILURE, errno, _("cannot get niceness"));
printf ("%d\n", current_niceness);
exit (EXIT_SUCCESS);
}
#else
current_niceness = GET_NICENESS ();
if (current_niceness == -1 && errno != 0)
- error (EXIT_FAIL, errno, _("cannot get niceness"));
+ error (EXIT_FAILURE, errno, _("cannot get niceness"));
ok = (setpriority (PRIO_PROCESS, 0, current_niceness + adjustment) == 0);
#endif
if (!ok)
- error (errno == EPERM ? 0 : EXIT_FAIL, errno, _("cannot set niceness"));
+ error (errno == EPERM ? 0 : EXIT_FAILURE, errno, _("cannot set niceness"));
execvp (argv[i], &argv[i]);
#ifdef HAVE_INITGROUPS
errno = 0;
if (initgroups (pw->pw_name, pw->pw_gid) == -1)
- error (EXIT_FAIL, errno, _("cannot set groups"));
+ error (EXIT_FAILURE, errno, _("cannot set groups"));
endgrent ();
#endif
if (setgid (pw->pw_gid))
- error (EXIT_FAIL, errno, _("cannot set group id"));
+ error (EXIT_FAILURE, errno, _("cannot set group id"));
if (setuid (pw->pw_uid))
- error (EXIT_FAIL, errno, _("cannot set user id"));
+ error (EXIT_FAILURE, errno, _("cannot set user id"));
}
/* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- initialize_exit_failure (EXIT_FAIL);
+ initialize_exit_failure (EXIT_FAILURE);
atexit (close_stdout);
fast_startup = false;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
- usage (EXIT_FAIL);
+ usage (EXIT_FAILURE);
}
}
pw = getpwnam (new_user);
if (! (pw && pw->pw_name && pw->pw_name[0] && pw->pw_dir && pw->pw_dir[0]
&& pw->pw_passwd))
- error (EXIT_FAIL, 0, _("user %s does not exist"), new_user);
+ error (EXIT_FAILURE, 0, _("user %s does not exist"), new_user);
/* Make a copy of the password information and point pw at the local
copy instead. Otherwise, some systems (e.g. Linux) would clobber
#ifdef SYSLOG_FAILURE
log_su (pw, false);
#endif
- error (EXIT_FAIL, 0, _("incorrect password"));
+ error (EXIT_FAILURE, 0, _("incorrect password"));
}
#ifdef SYSLOG_SUCCESS
else
#include <stdbool.h>
#include <stdlib.h>
-/* Exit statuses for programs like 'env' that exec other programs.
- EXIT_FAILURE might not be 1, so use EXIT_FAIL in such programs. */
+/* Exit statuses for programs like 'env' that exec other programs. */
enum
{
- EXIT_FAIL = 1,
EXIT_CANNOT_INVOKE = 126,
EXIT_ENOENT = 127
};
puts (_("not a tty"));
}
- exit (isatty (STDIN_FILENO) ? EXIT_SUCCESS : EXIT_FAIL);
+ exit (isatty (STDIN_FILENO) ? EXIT_SUCCESS : EXIT_FAILURE);
}