Skip to content

Commit bf6000d

Browse files
committed
[sanitizer] Fix the test on Solaris
On Solaris sem_open on the same name returns the same pointer, and then sem_close fails the call.
1 parent b714f73 commit bf6000d

File tree

1 file changed

+4
-10
lines changed
  • compiler-rt/test/sanitizer_common/TestCases/Posix

1 file changed

+4
-10
lines changed

compiler-rt/test/sanitizer_common/TestCases/Posix/sem_open.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,10 @@
1111

1212
int main() {
1313
char name[1024];
14-
sprintf(name, "/sem_open_test_%d", getpid());
15-
16-
sem_t *s1 = sem_open(name, O_CREAT, 0644, 123);
17-
assert(s1 != SEM_FAILED);
18-
19-
sem_t *s2 = sem_open(name, O_CREAT, 0644, 123);
20-
assert(s2 != SEM_FAILED);
21-
22-
assert(sem_close(s1) == 0);
23-
assert(sem_close(s2) == 0);
14+
sprintf(name, "/sem_open_test_%zu", (size_t)getpid());
2415

16+
sem_t *s = sem_open(name, O_CREAT, 0644, 123);
17+
assert(s != SEM_FAILED);
18+
assert(sem_close(s) == 0);
2519
assert(sem_unlink(name) == 0);
2620
}

0 commit comments

Comments
 (0)