svn commit: r345318 - head/usr.bin/lockf
Andriy Voskoboinyk
avos at FreeBSD.org
Wed Mar 20 07:40:39 UTC 2019
Author: avos
Date: Wed Mar 20 07:40:38 2019
New Revision: 345318
URL: https://svnweb.freebsd.org/changeset/base/345318
Log:
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
Modified:
head/usr.bin/lockf/lockf.c
Modified: head/usr.bin/lockf/lockf.c
==============================================================================
--- head/usr.bin/lockf/lockf.c Wed Mar 20 07:24:21 2019 (r345317)
+++ head/usr.bin/lockf/lockf.c Wed Mar 20 07:40:38 2019 (r345318)
@@ -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);
More information about the svn-src-all
mailing list