Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 2009 10:42:48 +0000 (UTC)
From:      Dag-Erling Smorgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r199134 - head/tools/regression/lib/libutil
Message-ID:  <200911101042.nAAAgmWN056191@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Tue Nov 10 10:42:48 2009
New Revision: 199134
URL: http://svn.freebsd.org/changeset/base/199134

Log:
  Check fork() return value

Modified:
  head/tools/regression/lib/libutil/test-flopen.c

Modified: head/tools/regression/lib/libutil/test-flopen.c
==============================================================================
--- head/tools/regression/lib/libutil/test-flopen.c	Tue Nov 10 10:34:44 2009	(r199133)
+++ head/tools/regression/lib/libutil/test-flopen.c	Tue Nov 10 10:42:48 2009	(r199134)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2007-2009 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2007-2009 Dag-Erling Coïdan Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -161,7 +161,10 @@ test_flopen_lock_child(void)
 	if (fd1 < 0) {
 		result = strerror(errno);
 	} else {
-		if ((pid = fork()) == 0) {
+		pid = fork();
+		if (pid == -1) {
+			result = strerror(errno);
+		} else if (pid == 0) {
 			select(0, 0, 0, 0, 0);
 			_exit(0);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911101042.nAAAgmWN056191>