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

Re: [PATCH 3/3] Ensure that gzfd is closed when writing newer deb format



Hi!

On Tue, 2013-08-27 at 18:28:32 +0200, Jérémy Bobbio wrote:
> ---
>  dpkg-deb/build.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
> index 41d14dc..4589e0b 100644
> --- a/dpkg-deb/build.c
> +++ b/dpkg-deb/build.c
> @@ -674,6 +674,8 @@ do_build(const char *const *argv)
>    /* Okay, we have data.tar as well now, add it to the ar wrapper. */
>    if (deb_format.major != 0) {
>      write_data_tar(debar, arfd, gzfd);
> +    if (fsync(gzfd))
> +      ohshite(_("unable to close temporary file for data member"));
>    }
>    if (fsync(arfd))
>      ohshite(_("unable to sync file '%s'"), debar);

Nicely spot, I applied a patch that close()es the fd (instead of
fsync()ing it), and ignores the error code, as with all other temp
file handling because we do not fsync() we do not check for close()
error codes either. In any case this will disappear once I rework
the code to avoid temporary files altogether, and the output file
will always get reliably fsync()ed and close()ed just once.

Thanks,
Guillem


Reply to: