- markus@cvs.openbsd.org 2001/05/06 21:23:31
[cli.c] cli_read() fails to catch SIGINT + overflow; from obdb@zzlevo.net
This commit is contained in:
parent
253effb61d
commit
e487d84e03
|
@ -1,3 +1,9 @@
|
||||||
|
20010509
|
||||||
|
- OpenBSD CVS Sync
|
||||||
|
- markus@cvs.openbsd.org 2001/05/06 21:23:31
|
||||||
|
[cli.c]
|
||||||
|
cli_read() fails to catch SIGINT + overflow; from obdb@zzlevo.net
|
||||||
|
|
||||||
20010508
|
20010508
|
||||||
- (bal) Fixed configure test for USE_SIA.
|
- (bal) Fixed configure test for USE_SIA.
|
||||||
|
|
||||||
|
@ -5357,4 +5363,4 @@
|
||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.1205 2001/05/07 12:54:26 mouring Exp $
|
$Id: ChangeLog,v 1.1206 2001/05/08 20:05:44 mouring Exp $
|
||||||
|
|
12
cli.c
12
cli.c
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: cli.c,v 1.12 2001/05/06 17:52:07 mouring Exp $ */
|
/* $OpenBSD: cli.c,v 1.13 2001/05/06 21:23:31 markus Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000 Markus Friedl. All rights reserved.
|
* Copyright (c) 2000 Markus Friedl. All rights reserved.
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: cli.c,v 1.12 2001/05/06 17:52:07 mouring Exp $");
|
RCSID("$OpenBSD: cli.c,v 1.13 2001/05/06 21:23:31 markus Exp $");
|
||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
@ -141,15 +141,19 @@ cli_read(char* buf, int size, int echo)
|
||||||
|
|
||||||
while (ch != '\n') {
|
while (ch != '\n') {
|
||||||
n = read(cli_input, &ch, 1);
|
n = read(cli_input, &ch, 1);
|
||||||
|
if (intr)
|
||||||
|
break;
|
||||||
if (n == -1 && (errno == EAGAIN || errno == EINTR))
|
if (n == -1 && (errno == EAGAIN || errno == EINTR))
|
||||||
continue;
|
continue;
|
||||||
if (n != 1)
|
if (n != 1)
|
||||||
break;
|
break;
|
||||||
if (ch == '\n' || intr != 0)
|
if (ch == '\n')
|
||||||
break;
|
break;
|
||||||
if (i < size)
|
if (i < size - 1)
|
||||||
buf[i++] = ch;
|
buf[i++] = ch;
|
||||||
}
|
}
|
||||||
|
if (intr)
|
||||||
|
i = 0;
|
||||||
buf[i] = '\0';
|
buf[i] = '\0';
|
||||||
|
|
||||||
if (!echo)
|
if (!echo)
|
||||||
|
|
Loading…
Reference in New Issue