diff options
author | wollman <wollman@FreeBSD.org> | 2002-05-03 17:28:28 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 2002-05-03 17:28:28 +0000 |
commit | ab1fc89ae22ff1f4a282785e7f2ea163ebf6fd7a (patch) | |
tree | fdfef76bf125040512e7fe45b9fbe9907b52a7f3 /lib/libc/stdtime | |
parent | 2600738fabff22295d51826e3ab5f34098f09bdf (diff) | |
download | FreeBSD-src-ab1fc89ae22ff1f4a282785e7f2ea163ebf6fd7a.zip FreeBSD-src-ab1fc89ae22ff1f4a282785e7f2ea163ebf6fd7a.tar.gz |
Fix fd leak. Threads people: does the call above to `access' need to be
underscored as well?
PR: 37717
Submitted by: fred@clift.org (slightly modified by me)
Diffstat (limited to 'lib/libc/stdtime')
-rw-r--r-- | lib/libc/stdtime/localtime.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index 09cfd3f..4f36f2b 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -316,8 +316,10 @@ struct state * const sp; return -1; if ((fid = _open(name, OPEN_MODE)) == -1) return -1; - if ((_fstat(fid, &stab) < 0) || !S_ISREG(stab.st_mode)) + if ((_fstat(fid, &stab) < 0) || !S_ISREG(stab.st_mode)) { + _close(fid); return -1; + } } { struct tzhead * tzhp; |