- TEST(r, !(sem=sem_open(buf, O_CREAT|O_EXCL, 0700, 1)), 0, "could not open sem");
+ TEST((sem=sem_open(buf, O_CREAT|O_EXCL, 0700, 1)) != SEM_FAILED,
+ "could not open sem: %s\n", strerror(errno));
+ errno = 0;
+ TEST(sem_open(buf, O_CREAT|O_EXCL, 0700, 1) == SEM_FAILED,
+ "reopening should fail with O_EXCL\n");
+ TEST(errno == EEXIST,
+ "after reopen failure errno is \"%s\" (%d); want EEXIST (%d)\n", strerror(errno), errno, EEXIST);
+ errno = 0;