Fix fd leak when lecture file option is enabled. From Jerry Brown

This commit is contained in:
Todd C. Miller
2005-11-11 16:22:58 +00:00
parent 3c6d0cc871
commit 50004e00b8

View File

@@ -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\