From ea3c5f99beb1bc1786d8b0b5e617229dd0287614 Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
Date: Sat, 1 Dec 2012 22:43:55 +0000
Subject: [PATCH] anacron: remove numeric exit and file descriptor values

Use symbolic values from standard header instead.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 anacron/main.c   | 18 +++++++++---------
 anacron/runjob.c | 10 +++++-----
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/anacron/main.c b/anacron/main.c
index 2c55716..66928cc 100644
--- a/anacron/main.c
+++ b/anacron/main.c
@@ -138,10 +138,10 @@ parse_opts(int argc, char *argv[])
 	    break;
 	case 'V':
 	    print_version();
-	    exit(0);
+	    exit(EXIT_SUCCESS);
 	case 'h':
 	    print_usage();
-	    exit(0);
+	    exit(EXIT_SUCCESS);
 	case '?':
 	    fprintf(stderr, "%s: invalid option: %c\n",
 		    program_name, optopt);
@@ -217,7 +217,7 @@ go_background()
     if (pid != 0)
     {
 	/* parent */
-	exit(0);
+	exit(EXIT_SUCCESS);
     }
     else
     {
@@ -318,7 +318,7 @@ orderly_termination()
     got_sigusr1 = 0;
     wait_children();
     explain("Exited");
-    exit(0);
+    exit(EXIT_SUCCESS);
 }
 
 static void
@@ -475,7 +475,7 @@ main(int argc, char *argv[])
     if (sigprocmask(0, NULL, &old_sigmask)) die_e("sigset error");
 
     if (fclose(stdin)) die_e("Can't close stdin");
-    xopen(0, "/dev/null", O_RDONLY);
+    xopen(STDIN_FILENO, "/dev/null", O_RDONLY);
 
     if (!no_daemon && !testing_only)
 	go_background();
@@ -489,15 +489,15 @@ main(int argc, char *argv[])
 
     if (testing_only)
     {
-	if (complaints) exit (1);
+	if (complaints) exit (EXIT_FAILURE);
 	
-	exit (0);
+	exit (EXIT_SUCCESS);
     }
 
     if (update_only)
     {
 	fake_jobs();
-	exit(0);
+	exit(EXIT_SUCCESS);
     }
 
     explain_intentions();
@@ -511,5 +511,5 @@ main(int argc, char *argv[])
     }
     wait_children();
     explain("Normal exit (%d job%s run)", njobs, njobs == 1 ? "" : "s");
-    exit(0);
+    exit(EXIT_SUCCESS);
 }
diff --git a/anacron/runjob.c b/anacron/runjob.c
index 2a44299..9656254 100644
--- a/anacron/runjob.c
+++ b/anacron/runjob.c
@@ -180,17 +180,17 @@ launch_mailer(job_rec *jr)
 	/* child */
 	in_background = 1;
 	/* set stdin to the job's output */
-	xclose(0);
-	if (dup2(jr->input_fd, 0) != 0) die_e("Can't dup2()");
-	if (lseek(0, 0, SEEK_SET) != 0) die_e("Can't lseek()");
+	xclose(STDIN_FILENO);
+	if (dup2(jr->input_fd, STDIN_FILENO) != 0) die_e("Can't dup2()");
+	if (lseek(STDIN_FILENO, 0, SEEK_SET) != 0) die_e("Can't lseek()");
 	umask(old_umask);
 	if (sigprocmask(SIG_SETMASK, &old_sigmask, NULL))
 	    die_e("sigprocmask error");
 	xcloselog();
 
 	/* Ensure stdout/stderr are sane before exec-ing sendmail */
-	xclose(1); xopen(1, "/dev/null", O_WRONLY);
-	xclose(2); xopen(2, "/dev/null", O_WRONLY);
+	xclose(STDOUT_FILENO); xopen(STDOUT_FILENO, "/dev/null", O_WRONLY);
+	xclose(STDERR_FILENO); xopen(STDERR_FILENO, "/dev/null", O_WRONLY);
 	xclose(jr->output_fd);
 
 	/* Ensure stdin is not appendable ... ? */
-- 
2.40.0