[PATCH] uuidd: use die() where possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx>
---
 misc-utils/uuidd.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index 4a230fb..8efa600 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -63,12 +63,10 @@ static void create_daemon(void)
 	uid_t euid;
 
 	pid = fork();
-	if (pid == -1) {
-		perror("fork");
-		exit(1);
-	} else if (pid != 0) {
-	    exit(0);
-	}
+	if (pid == -1)
+		die("fork");
+	else if (pid != 0)
+		exit(0);
 
 	close(0);
 	close(1);
@@ -286,10 +284,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
 	 */
 	while (!debug && s <= 2) {
 		s = dup(s);
-		if (s < 0) {
-			perror("dup");
-			exit(1);
-		}
+		if (s < 0)
+			die("dup");
 	}
 
 	/*
@@ -342,8 +338,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
 		if (ns < 0) {
 			if ((errno == EAGAIN) || (errno == EINTR))
 				continue;
-			perror("accept");
-			exit(1);
+			else
+				die("accept");
 		}
 		len = read(ns, &op, 1);
 		if (len != 1) {
-- 
1.7.1


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

Attachment: pgpn44JNodje7.pgp
Description: PGP signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux