diff options
author | 2009-06-07 13:06:02 +0000 | |
---|---|---|
committer | 2009-06-07 13:06:02 +0000 | |
commit | 675d97c0badf66b676dfc10c835ecaa319f051c7 (patch) | |
tree | b782ac87d453b74c0e169291365f9d242333b093 | |
parent | Remove outdated comment. (diff) | |
download | wireguard-openbsd-675d97c0badf66b676dfc10c835ecaa319f051c7.tar.xz wireguard-openbsd-675d97c0badf66b676dfc10c835ecaa319f051c7.zip |
Plug file descriptor leak when diffing regular files.
-rw-r--r-- | usr.bin/sdiff/sdiff.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c index 0cabe5c39a7..f5537210c50 100644 --- a/usr.bin/sdiff/sdiff.c +++ b/usr.bin/sdiff/sdiff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdiff.c,v 1.24 2009/06/07 12:39:40 ray Exp $ */ +/* $OpenBSD: sdiff.c,v 1.25 2009/06/07 13:06:02 ray Exp $ */ /* * Written by Raymond Lai <ray@cyth.net>. @@ -109,8 +109,10 @@ mktmpcpy(const char *source_file) err(2, "error getting file status from %s", source_file); /* Regular file. */ - if (S_ISREG(sb.st_mode)) + if (S_ISREG(sb.st_mode)) { + close(ifd); return (NULL); + } } else { /* If ``-'' does not exist the user meant stdin. */ if (errno == ENOENT && strcmp(source_file, "-") == 0) |