Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Mar 2019 08:55:59 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r345569 - in stable: 10/usr.bin/lockf 11/usr.bin/lockf 12/usr.bin/lockf
Message-ID:  <201903270855.x2R8txnK040141@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903270855.x2R8txnK040141>