summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2010-01-08 13:29:09 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2010-01-08 13:29:09 +0000
commit8f238bf9167617a15eb3d4e4faf30dc6189cc679 (patch)
tree2ba7251e610ec1e931081e5b8cbd3de12ff4445e
parentdc3742241db030c12758ee459d345f2da733c7fa (diff)
Don't leak the fds we open in cp() to copy one file from another.
from Igor Zinovik; thanks! ok millert@
-rw-r--r--usr.sbin/pwd_mkdb/pwd_mkdb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c
index 1a8e492d7fb..fdc1312d48b 100644
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd_mkdb.c,v 1.42 2009/10/27 23:59:54 deraadt Exp $ */
+/* $OpenBSD: pwd_mkdb.c,v 1.43 2010/01/08 13:29:08 oga Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -394,6 +394,8 @@ cp(char *from, char *to, mode_t mode)
errno = sverrno;
error(buf);
}
+ close(to_fd);
+ close(from_fd);
}
void