[PATCH] Fix error handling when fork() fails

y y
Sun Dec 6 11:57:08 PST 2009


From: Tomas Carnecky <tom at dbservice.com>

Previously we would exec() the requested command when fork() failed.
Add a missing break; and also use perror() to report the reason for
the failure.

Signed-off-by: Tomas Carnecky <tom at dbservice.com>
---
 os/utils.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/os/utils.c b/os/utils.c
index 3718b17..cbb75ca 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1351,7 +1351,9 @@ System(char *command)
 
     switch (pid = fork()) {
     case -1:	/* error */
+	perror("fork");
 	p = -1;
+	break;
     case 0:	/* child */
 	if (setgid(getgid()) == -1)
 	    _exit(127);
-- 
1.6.5.4




More information about the xorg-devel mailing list