test-flock.c:90: assertion failed, errno = 0
Abort trap
espresso:~/daily/gnulib/dummy-0/gltests jas$ 

Removing the line with the abort() call gives:

test-flock.c:89: assertion failed, errno = 0
test-flock.c:90: assertion failed, errno = 0
test-flock.c:91: assertion failed, errno = 0
test-flock.c:92: assertion failed, errno = 0
test-flock.c:93: assertion failed, errno = 0
test-flock.c:94: assertion failed, errno = 0
test-flock.c:96: assertion failed, errno = 9

The code reads:

  /* Some impossible operation codes which should never be accepted. */
  ASSERT (flock (fd, LOCK_SH | LOCK_EX) == -1);
  ASSERT (errno == EINVAL);
  ASSERT (flock (fd, LOCK_SH | LOCK_UN) == -1);
  ASSERT (errno == EINVAL);
  ASSERT (flock (fd, LOCK_EX | LOCK_UN) == -1);
  ASSERT (errno == EINVAL);
  ASSERT (flock (fd, 0) == -1);
  ASSERT (errno == EINVAL);

All but the next-to-last statement gives an assertion failure.  It seems
all other flock call returns 0.  Errno 9 is EBADF on this machine.

Maybe these particular self-tests aren't that useful?  I'm not sure it
is worth replacing the flock function just to fix these corner cases
that aren't used by real applications.  Thoughts?

/Simon


Reply via email to