Fix fd leak when lecture file option is enabled. From Jerry Brown
This commit is contained in:
1
check.c
1
check.c
@@ -126,6 +126,7 @@ lecture(status)
|
|||||||
if (def_lecture_file && (fp = fopen(def_lecture_file, "r")) != NULL) {
|
if (def_lecture_file && (fp = fopen(def_lecture_file, "r")) != NULL) {
|
||||||
while ((nread = fread(buf, sizeof(char), sizeof(buf), fp)) != 0)
|
while ((nread = fread(buf, sizeof(char), sizeof(buf), fp)) != 0)
|
||||||
fwrite(buf, nread, 1, stderr);
|
fwrite(buf, nread, 1, stderr);
|
||||||
|
fclose(fp);
|
||||||
} else {
|
} else {
|
||||||
(void) fputs("\n\
|
(void) fputs("\n\
|
||||||
We trust you have received the usual lecture from the local System\n\
|
We trust you have received the usual lecture from the local System\n\
|
||||||
|
Reference in New Issue
Block a user