summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2013-10-25 19:42:19 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2013-10-25 19:42:19 +0000
commit35f0c59c05b15e3f946653a1b78d996208cc6ae2 (patch)
treedb4b990307d047ecf53c13df2d8378f1294a89c3 /lib
parentb17f27ba85f977bffcb97e4904151470f193f2c3 (diff)
close(fd), then set errno
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/shm_open.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/shm_open.c b/lib/libc/gen/shm_open.c
index 02cac2f2dac..ccbe82a6c70 100644
--- a/lib/libc/gen/shm_open.c
+++ b/lib/libc/gen/shm_open.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: shm_open.c,v 1.2 2013/06/02 21:08:19 tedu Exp $ */
+/* $OpenBSD: shm_open.c,v 1.3 2013/10/25 19:42:18 tedu Exp $ */
/*
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
*
@@ -61,13 +61,13 @@ shm_open(const char *path, int flags, mode_t mode)
if (fd == -1)
return -1;
if (fstat(fd, &sb) == -1 || !S_ISREG(sb.st_mode)) {
- errno = EINVAL;
close(fd);
+ errno = EINVAL;
return -1;
}
if (sb.st_uid != getuid()) {
- errno = EPERM;
close(fd);
+ errno = EPERM;
return -1;
}
return fd;