PR/24796: Colin Percival: CPU-eating loop in lock(1); apply FreeBSD fix.
This commit is contained in:
parent
73a618d5f3
commit
eee22dae1e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lock.c,v 1.21 2003/08/07 11:14:22 agc Exp $ */
|
||||
/* $NetBSD: lock.c,v 1.22 2004/03/17 17:01:31 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1987, 1993
|
||||
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1987, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lock.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: lock.c,v 1.21 2003/08/07 11:14:22 agc Exp $");
|
||||
__RCSID("$NetBSD: lock.c,v 1.22 2004/03/17 17:01:31 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -61,6 +61,7 @@ __RCSID("$NetBSD: lock.c,v 1.21 2003/08/07 11:14:22 agc Exp $");
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -206,7 +207,7 @@ main(argc, argv)
|
||||
if (!fgets(s, sizeof(s), stdin)) {
|
||||
clearerr(stdin);
|
||||
hi(0);
|
||||
continue;
|
||||
goto tryagain;
|
||||
}
|
||||
if (usemine) {
|
||||
s[strlen(s) - 1] = '\0';
|
||||
@ -222,7 +223,8 @@ main(argc, argv)
|
||||
else if (!strcmp(s, s1))
|
||||
break;
|
||||
(void)printf("\a\n");
|
||||
if (tcsetattr(0, TCSADRAIN, &ntty) < 0)
|
||||
tryagain:
|
||||
if (tcsetattr(0, TCSADRAIN, &ntty) == -1 && errno != EINTR)
|
||||
exit(1);
|
||||
}
|
||||
quit(0);
|
||||
|
Loading…
Reference in New Issue
Block a user