[Spice-devel] [PATCH spice-vdagent v4] file-xfer: Check free space before file transfer

Christophe Fergeau cfergeau at redhat.com
Wed May 24 08:06:57 UTC 2017


Hey,

On Wed, May 24, 2017 at 08:38:53AM +0200, Pavel Grunt wrote:
> On Sun, 2017-05-21 at 15:19 +0200, Jakub Janků wrote:
> > Add function get_free_space_available that retrieves amount of free
> > space in the given directory. The statvfs may fail even when there's
> > enough free space (e.g. when not supported by system), in this case
> > return G_MAXUINT64 so that the transfer isn't terminated
> > groundlessly.

> #if GLIB_CHECK_VERSION(2, 30, 0)
> 
> > +            gchar *free_space_str = g_format_size(free_space);
> > +            gchar *file_size_str = g_format_size(task->file_size);
> > +            syslog(LOG_ERR, "file-xfer: not enough free space (%s
> > to copy, %s free)",
> > +                file_size_str, free_space_str);
> > +            g_free(free_space_str);
> > +            g_free(file_size_str);
> 
> #else
> 
> > +        } else {
> > +            syslog(LOG_ERR, "file-xfer: not enough free space (%lu
> > B to copy, %lu B free)",
> > +                task->file_size, free_space);
> > +        }
> 

Older glib had g_format_size_for_display() which might be better than
the raw number of bytes? (not really important, totally fine to keep
things this way).

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170524/49f2e91d/attachment.sig>


More information about the Spice-devel mailing list