fix overflow problem found by Rick Byers <rickb@iaw.on.ca>; fix by

<entropy@tardis.bernstein.com> in PR lib/4005.
This commit is contained in:
mikel 1997-08-19 04:34:15 +00:00
parent e72c8b76e8
commit e9484eba42
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: usleep.c,v 1.14 1997/07/21 14:07:45 jtc Exp $ */ /* $NetBSD: usleep.c,v 1.15 1997/08/19 04:34:15 mikel Exp $ */
/*- /*-
* Copyright (c) 1997 The NetBSD Foundation, Inc. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: usleep.c,v 1.14 1997/07/21 14:07:45 jtc Exp $"); __RCSID("$NetBSD: usleep.c,v 1.15 1997/08/19 04:34:15 mikel Exp $");
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include "namespace.h" #include "namespace.h"
@ -55,8 +55,8 @@ usleep(useconds)
{ {
struct timespec ts; struct timespec ts;
ts.tv_sec = 0; ts.tv_sec = useconds / 1000000;
ts.tv_nsec = useconds * 1000; ts.tv_nsec = (useconds % 1000000) * 1000;
nanosleep(&ts, NULL); nanosleep(&ts, NULL);
} }