--- fcntl_lock_thread.c.orig 2013-07-17 20:04:39.181918422 -0700 +++ fcntl_lock_thread.c 2013-07-17 20:07:17.767919133 -0700 @@ -97,7 +97,10 @@ lock.l_pid = getpid(); /* set a 4 byte write lock */ - fcntl(fd,F_SETLK,&lock); + ret = fcntl(fd,F_SETLK,&lock); + if (ret == -1) { + fprintf(stderr,"ERROR: lock test failed (ret=%d errno=%d)\n", ret, (int)errno); + } sleep(4); /* allow thread to try getting lock */