diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2009-06-07 13:06:03 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2009-06-07 13:06:03 +0000 |
commit | 2438d98eab6d696469de2c554d7d320c0ea92d2f (patch) | |
tree | 568dfd29cf9b8f40ac9d13519640315cfbd718dc /usr.bin/sdiff/sdiff.c | |
parent | ac5a265ca9b63b121cf5d45999a5c522dce60eb5 (diff) |
Plug file descriptor leak when diffing regular files.
Diffstat (limited to 'usr.bin/sdiff/sdiff.c')
-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) |