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

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

 



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

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]