diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/getttyent.c | 4 | ||||
-rw-r--r-- | misc/mntent_r.c | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/misc/getttyent.c b/misc/getttyent.c index 07018f7..e886e58 100644 --- a/misc/getttyent.c +++ b/misc/getttyent.c @@ -73,8 +73,10 @@ getttyent() return (NULL); flockfile (tf); for (;;) { - if (!fgets_unlocked(p = line, sizeof(line), tf)) + if (!fgets_unlocked(p = line, sizeof(line), tf)) { + funlockfile (tf); return (NULL); + } /* skip lines that are too big */ if (!index(p, '\n')) { while ((c = getc_unlocked(tf)) != '\n' && c != EOF) diff --git a/misc/mntent_r.c b/misc/mntent_r.c index 9567a6f..94b1d15 100644 --- a/misc/mntent_r.c +++ b/misc/mntent_r.c @@ -57,7 +57,10 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz) char *end_ptr; if (fgets_unlocked (buffer, bufsiz, stream) == NULL) - return NULL; + { + funlockfile (stream); + return NULL; + } end_ptr = strchr (buffer, '\n'); if (end_ptr != NULL) /* chop newline */ |