Simple file locking wrapper command in C
Besides reinventing the wheel the things I'm concerned about are:


the warn in attemptLock, because if either creating the lock file
fails, or if you can't get the lock (or the call was interrupted), I
would expect the wrapper to exit instead,
the return value of open, which might very well be negative, so just
check for that separately and give an error message for that,
the return value of flock, where you should handle EINTR in a loop
I believe?