lockf(1): return EX_UNAVAILABLE if -n is used and the lock file does not
exist Apply EX_UNAVAILABLE patch part from PR 170775 to match the documentation. Checked with a command from PR 210770: lockf -n /tmp/doesnotexist echo; echo $? PR: 210770 MFC after: 1 week
This commit is contained in:
parent
b55bb76366
commit
d614ded66a
@ -174,6 +174,8 @@ acquire_lock(const char *name, int flags)
|
||||
if ((fd = open(name, O_RDONLY|O_EXLOCK|flags, 0666)) == -1) {
|
||||
if (errno == EAGAIN || errno == EINTR)
|
||||
return (-1);
|
||||
else if (errno == ENOENT && (flags & O_CREAT) == 0)
|
||||
err(EX_UNAVAILABLE, "%s", name);
|
||||
err(EX_CANTCREAT, "cannot open %s", name);
|
||||
}
|
||||
return (fd);
|
||||
|
Loading…
Reference in New Issue
Block a user