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
This commit is contained in:
Warner Losh 2001-05-30 21:45:50 +00:00
parent 6a40ef8254
commit eae79da24b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77501

View file

@ -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);
}