Source-Changes-HG archive

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

[src/trunk]: src/bin/sleep PR/14558: Tero Kivinen: Check the return value of ...



details:   https://anonhg.NetBSD.org/src/rev/41b1060dfe34
branches:  trunk
changeset: 517406:41b1060dfe34
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Nov 12 14:55:53 2001 +0000

description:
PR/14558: Tero Kivinen: Check the return value of nanosleep and don't fail
silently.

diffstat:

 bin/sleep/sleep.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 45bccf32aaae -r 41b1060dfe34 bin/sleep/sleep.c
--- a/bin/sleep/sleep.c Mon Nov 12 14:52:33 2001 +0000
+++ b/bin/sleep/sleep.c Mon Nov 12 14:55:53 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sleep.c,v 1.17 2001/09/16 21:18:33 wiz Exp $ */
+/* $NetBSD: sleep.c,v 1.18 2001/11/12 14:55:53 christos Exp $ */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -43,11 +43,12 @@
 #if 0
 static char sccsid[] = "@(#)sleep.c    8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: sleep.c,v 1.17 2001/09/16 21:18:33 wiz Exp $");
+__RCSID("$NetBSD: sleep.c,v 1.18 2001/11/12 14:55:53 christos Exp $");
 #endif
 #endif /* not lint */
 
 #include <ctype.h>
+#include <err.h>
 #include <locale.h>
 #include <math.h>
 #include <signal.h>
@@ -119,7 +120,8 @@
                ntime.tv_nsec = 0;
        }
 
-       (void)nanosleep(&ntime, NULL);
+       if (nanosleep(&ntime, NULL) == -1)
+               err(1, "nanosleep failed");
 
        exit(0);
        /* NOTREACHED */



Home | Main Index | Thread Index | Old Index