bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

powerpc-apple-darwin8.11.0 flock: accepts impossible operations


From: Simon Josefsson
Subject: powerpc-apple-darwin8.11.0 flock: accepts impossible operations
Date: Tue, 09 Dec 2008 10:57:56 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux)

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

[Prev in Thread] Current Thread [Next in Thread]