From 1a29dc59c5c30d714948258a150c11d0ea5e4744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Tue, 10 Nov 2009 10:42:48 +0000 Subject: [PATCH] Check fork() return value --- tools/regression/lib/libutil/test-flopen.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/regression/lib/libutil/test-flopen.c b/tools/regression/lib/libutil/test-flopen.c index d6ecac3a315e..a3ae35c7ea55 100644 --- a/tools/regression/lib/libutil/test-flopen.c +++ b/tools/regression/lib/libutil/test-flopen.c @@ -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); }