diff options
author | imp <imp@FreeBSD.org> | 2001-05-30 21:45:50 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2001-05-30 21:45:50 +0000 |
commit | 189d400eedf92f3d35a5905015f0204ce7a9e3a2 (patch) | |
tree | 3cc26d7b9f5e98c43113fa5ec50d00cb1ed8c3f5 /usr.sbin/pccard | |
parent | ad49bfa922febb732282ba68873a15a1de6cdfa7 (diff) | |
download | FreeBSD-src-189d400eedf92f3d35a5905015f0204ce7a9e3a2.zip FreeBSD-src-189d400eedf92f3d35a5905015f0204ce7a9e3a2.tar.gz |
From the PR:
The PCCard daemon can hang indefinately while reading its
configuration file. If the last line of the file is a comment line
that does not end in a newline, the program goes into an infinite
loop searching for the non-existent newline.
This fix, provided by the PR, will allow files ending without a newline
to be read without hanging.
Submitted by: Crist J. Clark <cjclark@alum.mit.edu>
PR: bin/25791
Diffstat (limited to 'usr.sbin/pccard')
-rw-r--r-- | usr.sbin/pccard/pccardd/file.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.sbin/pccard/pccardd/file.c b/usr.sbin/pccard/pccardd/file.c index ec3010c..0bfcc0b 100644 --- a/usr.sbin/pccard/pccardd/file.c +++ b/usr.sbin/pccard/pccardd/file.c @@ -836,10 +836,8 @@ get(void) } if (c == '\n') lineno++; - if (c == '#') { - while (get() != '\n'); - return (last_char = '\n'); - } + if (c == '#') + while (((c = get()) != '\n') && (c != EOF)); return (last_char = c); } |