Author: avos Date: Wed Mar 27 08:55:59 2019 New Revision: 345569 URL: https://svnweb.freebsd.org/changeset/base/345569
Log: 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 Modified: stable/10/usr.bin/lockf/lockf.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.bin/lockf/lockf.c stable/12/usr.bin/lockf/lockf.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/usr.bin/lockf/lockf.c ============================================================================== --- stable/10/usr.bin/lockf/lockf.c Wed Mar 27 08:02:55 2019 (r345568) +++ stable/10/usr.bin/lockf/lockf.c Wed Mar 27 08:55:59 2019 (r345569) @@ -172,6 +172,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); _______________________________________________ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"