1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-30 07:10:58 +02:00

print message if we give up trying to crate a lock file with hard links

This commit is contained in:
Peter Stephenson 2009-03-10 14:23:15 +00:00
parent e391f09457
commit 7c302e129f
2 changed files with 10 additions and 4 deletions

View file

@ -1,5 +1,8 @@
2009-03-10 Peter Stephenson <pws@csr.com> 2009-03-10 Peter Stephenson <pws@csr.com>
* 26708: Src/hist.c: print message if we give up trying to
create a lock file with hard links.
* 26705: Src/subst.c, Test/D07multibyte.ztst: still problems * 26705: Src/subst.c, Test/D07multibyte.ztst: still problems
with multibyte characters with Meta in prompt expansion within with multibyte characters with Meta in prompt expansion within
parameter expansion. parameter expansion.
@ -11367,5 +11370,5 @@
***************************************************** *****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL * This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.4607 $ * $Revision: 1.4608 $
***************************************************** *****************************************************

View file

@ -2433,13 +2433,16 @@ lockhistfile(char *fn, int keep_trying)
} else } else
close(fd); close(fd);
while (link(tmpfile, lockfile) < 0) { while (link(tmpfile, lockfile) < 0) {
if (errno != EEXIST || !keep_trying) if (errno != EEXIST)
zerr("failed to create hard link as lock file %s: %e",
lockfile, errno);
else if (!keep_trying)
; ;
else if (stat(lockfile, &sb) < 0) { else if (stat(lockfile, &sb) < 0) {
if (errno == ENOENT) if (errno == ENOENT)
continue; continue;
} zerr("failed to stat lock file %s: %e", lockfile, errno);
else { } else {
if (time(NULL) - sb.st_mtime < 10) if (time(NULL) - sb.st_mtime < 10)
sleep(1); sleep(1);
else else