mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
MFC r345318:
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. Was checked with a command from PR 210770: lockf -n /tmp/doesnotexist echo; echo $? PR: 210770
This commit is contained in:
1 parent
be65c0eac9
commit
7f14ada8a7
1 file changed
+2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/11/; revision=345569
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user