svn commit: r345569 - in stable: 10/usr.bin/lockf 11/usr.bin/lockf 12/usr.bin/lockf

Andriy Voskoboinyk avos at FreeBSD.org
Wed Mar 27 08:56:00 UTC 2019


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/11/usr.bin/lockf/lockf.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/usr.bin/lockf/lockf.c
  stable/12/usr.bin/lockf/lockf.c
Directory Properties:
  stable/10/   (props changed)
  stable/12/   (props changed)

Modified: stable/11/usr.bin/lockf/lockf.c
==============================================================================
--- stable/11/usr.bin/lockf/lockf.c	Wed Mar 27 08:02:55 2019	(r345568)
+++ stable/11/usr.bin/lockf/lockf.c	Wed Mar 27 08:55:59 2019	(r345569)
@@ -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