summaryrefslogtreecommitdiff
path: root/bin/ksh/history.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2006-03-17 16:30:14 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2006-03-17 16:30:14 +0000
commit545662306a341986faab81d8a2adb54b559c6830 (patch)
tree3c5e3664174a1c48bbb24f80a3810b68c133026f /bin/ksh/history.c
parent655efa37b5c8313ced96c25d2ed9b4346d8837fa (diff)
Simplify savefd() by removing the "noclose" flag and make noclose
behavior the default. Almost all uses of savefd() are followed by an implicit or explicit close. OK otto@
Diffstat (limited to 'bin/ksh/history.c')
-rw-r--r--bin/ksh/history.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/ksh/history.c b/bin/ksh/history.c
index 7b959455f95..bcd7ee6fbf3 100644
--- a/bin/ksh/history.c
+++ b/bin/ksh/history.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: history.c,v 1.33 2006/03/12 00:26:58 deraadt Exp $ */
+/* $OpenBSD: history.c,v 1.34 2006/03/17 16:30:13 millert Exp $ */
/*
* command history
@@ -646,7 +646,9 @@ hist_init(Source *s)
if ((fd = open(hname, O_RDWR|O_CREAT|O_APPEND, 0600)) < 0)
return;
- histfd = savefd(fd, 0);
+ histfd = savefd(fd);
+ if (histfd != fd)
+ close(fd);
(void) flock(histfd, LOCK_EX);