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

silently.
This commit is contained in:
christos 2001-11-12 14:55:53 +00:00
parent 6ff985ffa8
commit 182abdd796

View File

@ -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 * Copyright (c) 1988, 1993, 1994
@ -43,11 +43,12 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\
#if 0 #if 0
static char sccsid[] = "@(#)sleep.c 8.3 (Berkeley) 4/2/94"; static char sccsid[] = "@(#)sleep.c 8.3 (Berkeley) 4/2/94";
#else #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
#endif /* not lint */ #endif /* not lint */
#include <ctype.h> #include <ctype.h>
#include <err.h>
#include <locale.h> #include <locale.h>
#include <math.h> #include <math.h>
#include <signal.h> #include <signal.h>
@ -119,7 +120,8 @@ main(int argc, char *argv[])
ntime.tv_nsec = 0; ntime.tv_nsec = 0;
} }
(void)nanosleep(&ntime, NULL); if (nanosleep(&ntime, NULL) == -1)
err(1, "nanosleep failed");
exit(0); exit(0);
/* NOTREACHED */ /* NOTREACHED */