projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cfe581b
)
fix failure behavior of sem_open when sem does not exist
author
Rich Felker
<dalias@aerifal.cx>
Fri, 11 Mar 2011 03:05:16 +0000
(22:05 -0500)
committer
Rich Felker
<dalias@aerifal.cx>
Fri, 11 Mar 2011 03:05:16 +0000
(22:05 -0500)
src/thread/sem_open.c
patch
|
blob
|
history
diff --git
a/src/thread/sem_open.c
b/src/thread/sem_open.c
index 6fff71a8512090eb588bb0329e30a51917ca8242..809925d25a7a38834dc7bde773611507d809b930 100644
(file)
--- a/
src/thread/sem_open.c
+++ b/
src/thread/sem_open.c
@@
-100,7
+100,7
@@
sem_t *sem_open(const char *name, int flags, ...)
close(tfd);
unlink(tmp);
}
- if (fstat(fd, &st) < 0) {
+ if (f
d >= 0 && f
stat(fd, &st) < 0) {
close(fd);
fd = -1;
}
@@
-118,6
+118,10
@@
sem_t *sem_open(const char *name, int flags, ...)
break;
}
}
+ if (!(flags & O_CREAT)) {
+ pthread_spin_unlock(&lock);
+ return SEM_FAILED;
+ }
if (!linkat(AT_FDCWD, tmp, dir, name, 0)) {
fd = tfd;
close(dir);