[Pkg-xfce-devel] Bug#583922: thunar: does not check return value of close() when copying files
On Mon, 2010-05-31 at 21:42 +0200, Yves-Alexis Perez wrote:
> On lun., 2010-05-31 at 13:33 -0400, John Lindgren wrote:
> > tags 583922 patch
> > thanks
> >
> > --- thunar-vfs-io-local-xfer.c.0 2010-05-21 13:10:52.000000000 -0400
> > +++ thunar-vfs-io-local-xfer.c 2010-05-31 13:14:00.555777901 -0400
> > @@ -330,6 +330,11 @@
> > futimes (target_fd, times);
> > #endif
> >
> > + /* check that the data is successfully written */
> > + if (G_UNLIKELY (fsync (target_fd) < 0))
> > + tvilx_set_error_with_path (error, _("Failed to sync data to \"%s\""),
> > + target_absolute_path);
> > +
> > /* close the file descriptors */
> > close (target_fd);
> > end1:
>
> It seems that it's not the right patch for the right bug. This one looks
> more useful for #583325.
It will work for both. By checking that fsync succeeds, it makes sure
that all the data has been written to disk, which eliminates the chance
of silent data loss (#583922) and also fixes the misleading progress bar
(#583325). (If we check the return value of fsync, then it's no longer
necessary to check the return value of close).
John Lindgren
Reply to: