bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: install-info can "corrupt" dir file if interrupted.


From: Andreas Schwab
Subject: Re: install-info can "corrupt" dir file if interrupted.
Date: Sat, 03 Dec 2022 22:03:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

On Dez 03 2022, Gavin Smith wrote:

> I've done this:
>
> --- a/install-info/install-info.c
> +++ b/install-info/install-info.c
> @@ -1054,7 +1054,20 @@ output_dirfile (char *dirfile, int dir_nlines, struct 
> line_data *dir_lines,
>    /* Update dir file atomically.  This stops the dir file being corrupted
>       if install-info is interrupted. */
>    if (rename (tempname, dirfile) == -1)
> -    perror (tempname);
> +    {
> +      /* Try to delete target file and try again.  On some platforms you
> +         may not rename to an existing file. */
> +      if (remove (dirfile) == -1)

I think the remove failure should be ignored.  If rename fails for other
reasons than an existing destination, this may lose the original failure
condition from rename, reporting a confusing and unrelated error.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]