Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/gnu/libexec/uucp/libunix Pull up revision 1.6 (requeste...
details: https://anonhg.NetBSD.org/src/rev/e62009c95237
branches: netbsd-1-5
changeset: 491623:e62009c95237
user: he <he%NetBSD.org@localhost>
date: Thu May 03 21:24:56 2001 +0000
description:
Pull up revision 1.6 (requested by is):
Avoid division by zero when computing timeouts for pipe connections.
diffstat:
gnu/libexec/uucp/libunix/serial.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diffs (49 lines):
diff -r 93fc12427fee -r e62009c95237 gnu/libexec/uucp/libunix/serial.c
--- a/gnu/libexec/uucp/libunix/serial.c Thu May 03 21:23:10 2001 +0000
+++ b/gnu/libexec/uucp/libunix/serial.c Thu May 03 21:24:56 2001 +0000
@@ -26,7 +26,7 @@
#include "uucp.h"
#if USE_RCS_ID
-const char serial_rcsid[] = "$Id: serial.c,v 1.5 1998/02/14 07:25:55 mycroft Exp $";
+const char serial_rcsid[] = "$Id: serial.c,v 1.5.8.1 2001/05/03 21:24:56 he Exp $";
#endif
#include "uudefs.h"
@@ -2376,7 +2376,8 @@
else
csleepchars = MAX_INPUT - 10;
- isleep = (int) (((long) csleepchars * 10000L) / q->ibaud);
+ isleep = q->ibaud ? (int) (((long) csleepchars * 10000L) / q->ibaud)
+ : 1000;
isleep -= 10;
if (isleep > 10)
@@ -2778,9 +2779,14 @@
/ baud bits/sec)
* 10 bits/byte)
*/
- stime.tv_sec = (long) 10240 / q->ibaud;
- stime.tv_usec = ((((long) 1024000000 / q->ibaud) * (long) 10)
- % (long) 1000000);
+ if (q->ibaud) {
+ stime.tv_sec = (long) 10240 / q->ibaud;
+ stime.tv_usec = ((((long) 1024000000 / q->ibaud) * (long) 10)
+ % (long) 1000000);
+ } else {
+ stime.tv_sec = 1;
+ stime.tv_usec = 0;
+ }
imask = 1 << q->o;
if (imask == 0)
@@ -2851,7 +2857,7 @@
we don't need to use the catch stuff, since we know
that HAVE_RESTARTABLE_SYSCALLS is 0. */
usset_signal (SIGALRM, usalarm, TRUE, (boolean *) NULL);
- alarm ((int) ((long) 10240 / q->ibaud) + 1);
+ alarm ( q->ibaud ? (int) ((long) 10240 / q->ibaud) + 1 : 1);
/* There is a race condition here: on a severely loaded
system, we could get the alarm before we start the
Home |
Main Index |
Thread Index |
Old Index