mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-18 14:17:03 +01:00
Revert last change, add comment about link() return values.
* common/dotlock.c (use_hardlinks_p, dotlock_take_unix): Do not check return value of link().
This commit is contained in:
parent
0dce26778e
commit
ff2095ad7b
@ -583,11 +583,9 @@ use_hardlinks_p (const char *tname)
|
|||||||
strcpy (lname, tname);
|
strcpy (lname, tname);
|
||||||
strcat (lname, "x");
|
strcat (lname, "x");
|
||||||
|
|
||||||
res = link (tname, lname);
|
/* We ignore the return value of link() because it is unreliable. */
|
||||||
if (res < 0)
|
(void) link (tname, lname);
|
||||||
res = -1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (stat (tname, &sb))
|
if (stat (tname, &sb))
|
||||||
res = -1; /* Ooops. */
|
res = -1; /* Ooops. */
|
||||||
else if (sb.st_nlink == nlink + 1)
|
else if (sb.st_nlink == nlink + 1)
|
||||||
@ -596,8 +594,6 @@ use_hardlinks_p (const char *tname)
|
|||||||
res = 1; /* No hardlink support. */
|
res = 1; /* No hardlink support. */
|
||||||
|
|
||||||
unlink (lname);
|
unlink (lname);
|
||||||
}
|
|
||||||
|
|
||||||
jnlib_free (lname);
|
jnlib_free (lname);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -953,7 +949,6 @@ dotlock_destroy (dotlock_t h)
|
|||||||
static int
|
static int
|
||||||
dotlock_take_unix (dotlock_t h, long timeout)
|
dotlock_take_unix (dotlock_t h, long timeout)
|
||||||
{
|
{
|
||||||
int res;
|
|
||||||
int wtime = 0;
|
int wtime = 0;
|
||||||
int sumtime = 0;
|
int sumtime = 0;
|
||||||
int pid;
|
int pid;
|
||||||
@ -1010,13 +1005,8 @@ dotlock_take_unix (dotlock_t h, long timeout)
|
|||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
res = link (h->tname, h->lockname);
|
/* We ignore the return value of link() because it is unreliable. */
|
||||||
if (res < 0)
|
(void) link (h->tname, h->lockname);
|
||||||
{
|
|
||||||
my_error_1 ("lock not made: Oops: link of tmp file failed: %s\n",
|
|
||||||
strerror (errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stat (h->tname, &sb))
|
if (stat (h->tname, &sb))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user