1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 05:16:05 +01:00

39268: "zsystem flock -t 0 ..." tries only once to flock and immediately returns success or failure

This commit is contained in:
Barton E. Schaefer 2016-09-11 17:22:02 -07:00
parent ef019506ae
commit 26b4508ee3
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2016-09-11 Barton E. Schaefer <schaefer@zsh.org>
* 39268: Src/Modules/system.c: "zsystem flock -t 0 ..." tries only
once to flock and immediately returns success or failure
2016-09-11 Vin Shelton <ethersoft@gmail.com>
* 39284: Doc/Zsh/compsys.yo:

View file

@ -521,7 +521,7 @@ static int
bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
{
int cloexec = 1, unlock = 0, readlock = 0;
time_t timeout = 0;
zlong timeout = -1;
char *fdvar = NULL;
#ifdef HAVE_FCNTL_H
struct flock lck;
@ -573,7 +573,7 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
} else {
optarg = *args++;
}
timeout = (time_t)mathevali(optarg);
timeout = mathevali(optarg);
break;
case 'u':
@ -650,7 +650,7 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
sleep(1);
}
} else {
while (fcntl(flock_fd, F_SETLKW, &lck) < 0) {
while (fcntl(flock_fd, timeout == 0 ? F_SETLK : F_SETLKW, &lck) < 0) {
if (errflag)
return 1;
if (errno == EINTR)