summaryrefslogtreecommitdiff
path: root/sys/lib/libsa
diff options
context:
space:
mode:
authormartin <martin@NetBSD.org>2013-04-14 22:23:28 +0000
committermartin <martin@NetBSD.org>2013-04-14 22:23:28 +0000
commit7d7bc2bf9bde3ffa5ef867d4c65457057e40bb86 (patch)
tree57d3db5bca54d4e8edf98815b8593adeab8e6850 /sys/lib/libsa
parentacda65d74cd5b417d03525682f94340d7822eb2b (diff)
Make the check in close() for a non-deflatable file mode symetric to
the one in open(). Avoids dealloc() calls on NULL.
Diffstat (limited to 'sys/lib/libsa')
-rw-r--r--sys/lib/libsa/cread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/lib/libsa/cread.c b/sys/lib/libsa/cread.c
index 808690cef54..c7b7f450fc2 100644
--- a/sys/lib/libsa/cread.c
+++ b/sys/lib/libsa/cread.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cread.c,v 1.23 2009/03/25 18:41:06 tls Exp $ */
+/* $NetBSD: cread.c,v 1.24 2013/04/14 22:23:28 martin Exp $ */
/*
* Copyright (c) 1996
@@ -302,7 +302,7 @@ close(int fd)
#endif
f = &files[fd];
- if ((f->f_flags & F_READ) == 0)
+ if ((f->f_flags & (F_READ|F_WRITE)) == F_READ)
return oclose(fd);
s = ss[fd];