[dev] [utmp][PATCH] Use same die() call in parent and child

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Thu, 7 Aug 2014 15:51:34 +0200

---
 utmp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/utmp.c b/utmp.c
index d0d556c..53429a8 100644
--- a/utmp.c
+++ b/utmp.c
_AT_@ -41,6 +41,7 @@ main(int argc, char *argv[])
 	int status;
 	uid_t uid;
 	sigset_t set;
+	char *err;
 	extern void addutmp(void), delutmp(void);
 
 	egid = getegid();
_AT_@ -58,15 +59,16 @@ main(int argc, char *argv[])
 
 	sigfillset(&set);
 	sigprocmask(SIG_BLOCK, &set, NULL);
+	err = "error spawning child:%s";
 
 	switch (fork()) {
 	case 0:
 		sigprocmask(SIG_UNBLOCK, &set, NULL);
 		argv[0] = getenv("SHELL");
 		execv(argv[0], argv);
-		die("error executing shell:%s", strerror(errno));
+		err = "error executing shell:%s" ;
 	case -1:
-		die("error spawning child:%s", strerror(errno));
+		die(err, strerror(errno));
 	default:
 		addutmp();
 		signal(SIGINT, SIG_IGN);
-- 
1.9.3
Received on Thu Aug 07 2014 - 15:51:34 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 07 2014 - 16:00:11 CEST