mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-31 11:41:32 +01:00
common: Improve error return for dotlock.
* common/dotlock.c (dotlock_take_unix): Return a ETIMEDOUT insteaad of EACCESS on timeout. (dotlock_take_w32): Ditto.
This commit is contained in:
parent
6b93b92111
commit
f57717bf23
@ -1061,6 +1061,7 @@ static int
|
|||||||
dotlock_take_unix (dotlock_t h, long timeout)
|
dotlock_take_unix (dotlock_t h, long timeout)
|
||||||
{
|
{
|
||||||
int wtime = 0;
|
int wtime = 0;
|
||||||
|
int timedout = 0;
|
||||||
int sumtime = 0;
|
int sumtime = 0;
|
||||||
int pid;
|
int pid;
|
||||||
int lastpid = -1;
|
int lastpid = -1;
|
||||||
@ -1218,6 +1219,8 @@ dotlock_take_unix (dotlock_t h, long timeout)
|
|||||||
wtime = 0; /* Reset because owner chnaged. */
|
wtime = 0; /* Reset because owner chnaged. */
|
||||||
|
|
||||||
wtimereal = next_wait_interval (&wtime, &timeout);
|
wtimereal = next_wait_interval (&wtime, &timeout);
|
||||||
|
if (!timeout)
|
||||||
|
timedout = 1; /* remember. */
|
||||||
|
|
||||||
sumtime += wtimereal;
|
sumtime += wtimereal;
|
||||||
if (sumtime >= 1500)
|
if (sumtime >= 1500)
|
||||||
@ -1233,7 +1236,7 @@ dotlock_take_unix (dotlock_t h, long timeout)
|
|||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
my_set_errno (EACCES);
|
my_set_errno (timedout? ETIMEDOUT : EACCES);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /*HAVE_POSIX_SYSTEM*/
|
#endif /*HAVE_POSIX_SYSTEM*/
|
||||||
@ -1246,6 +1249,7 @@ static int
|
|||||||
dotlock_take_w32 (dotlock_t h, long timeout)
|
dotlock_take_w32 (dotlock_t h, long timeout)
|
||||||
{
|
{
|
||||||
int wtime = 0;
|
int wtime = 0;
|
||||||
|
int timedout = 0;
|
||||||
int w32err;
|
int w32err;
|
||||||
OVERLAPPED ovl;
|
OVERLAPPED ovl;
|
||||||
|
|
||||||
@ -1273,6 +1277,8 @@ dotlock_take_w32 (dotlock_t h, long timeout)
|
|||||||
int wtimereal;
|
int wtimereal;
|
||||||
|
|
||||||
wtimereal = next_wait_interval (&wtime, &timeout);
|
wtimereal = next_wait_interval (&wtime, &timeout);
|
||||||
|
if (!timeout)
|
||||||
|
timedout = 1; /* remember. */
|
||||||
|
|
||||||
if (wtime >= 800)
|
if (wtime >= 800)
|
||||||
my_info_1 (_("waiting for lock %s...\n"), h->lockname);
|
my_info_1 (_("waiting for lock %s...\n"), h->lockname);
|
||||||
@ -1281,7 +1287,7 @@ dotlock_take_w32 (dotlock_t h, long timeout)
|
|||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
my_set_errno (EACCES);
|
my_set_errno (timedout? ETIMEDOUT : EACCES);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /*HAVE_DOSISH_SYSTEM*/
|
#endif /*HAVE_DOSISH_SYSTEM*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user