diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2013-10-25 19:42:19 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2013-10-25 19:42:19 +0000 |
commit | 35f0c59c05b15e3f946653a1b78d996208cc6ae2 (patch) | |
tree | db4b990307d047ecf53c13df2d8378f1294a89c3 /lib | |
parent | b17f27ba85f977bffcb97e4904151470f193f2c3 (diff) |
close(fd), then set errno
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/shm_open.c | 6 |
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; |