if we don't have rights to write into lockdir, it's generally bad news, avoid

getting stuck.

work with Stefan Rinkes.
This commit is contained in:
espie 2011-04-13 08:37:16 +00:00
parent 1e56c617d5
commit b5b62e9c6b

View File

@ -1,5 +1,5 @@
#! /usr/bin/perl
# $OpenBSD: dolock,v 1.1 2010/08/20 14:40:31 espie Exp $
# $OpenBSD: dolock,v 1.2 2011/04/13 08:37:16 espie Exp $
# Copyright (c) 2004 Marc Espie <espie@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
@ -34,6 +34,10 @@ if (!-d $dname) {
print STDERR "lock directory location $dname is not a directory\n";
exit(1);
}
if (!-w _) {
print STDERR "you don't have permission to write into $dname\n";
exit(1);
}
while(1) {
if (sysopen my $handle, $fname, O_WRONLY | O_EXCL | O_CREAT, 0666) {