]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
flock: zero timeout is valid
authorKarel Zak <kzak@redhat.com>
Tue, 7 Oct 2014 10:12:39 +0000 (12:12 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 24 Oct 2014 09:10:06 +0000 (11:10 +0200)
This patch reverts Sami's "timeout cannot be zero", introduced
in commit 605325b23b36238c8f3ae165e37cab9064553cf7.

The --timeout 0 has been originally interpreted as --nonblock. The
patch also add hint about this behavior to the man page.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1149974
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/flock.1
sys-utils/flock.c

index 6c28a35d7ef6a7cf3f2d0667bca7fed57f524860..3c1feb2a551fd910897c4bfe17b675bf178800fe 100644 (file)
@@ -87,7 +87,9 @@ Fail if the lock cannot be acquired within
 Decimal fractional values are allowed.
 See the
 .B \-E
-option for the exit code used.
+option for the exit code used. The zero number of
+.IR seconds
+is interpreted as \fB\-\-nonblock\fR.
 .TP
 \fB\-o\fP, \fB\-\-close\fP
 Close the file descriptor on which the lock is held before executing
index f160eaca522dc3c9821095448b5a7972ffaad7cd..7ef24d2f3a46317e2f606da9e923adcda6f9360f 100644 (file)
@@ -175,8 +175,6 @@ int main(int argc, char *argv[])
                        have_timeout = 1;
                        strtotimeval_or_err(optarg, &timeout.it_value,
                                _("invalid timeout value"));
-                       if (timeout.it_value.tv_sec + timeout.it_value.tv_usec == 0)
-                               errx(EX_USAGE, _("timeout cannot be zero"));
                        break;
                case 'E':
                        conflict_exit_code = strtos32_or_err(optarg,