mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
Fallback to rename() if link() is not available (when no support on target
2008-02-06 Tomas Bzatek <tbzatek@redhat.com> * glocalfileoutputstream.c (g_local_file_output_stream_close): Fallback to rename() if link() is not available (when no support on target filesystem) svn path=/trunk/; revision=6464
This commit is contained in:
parent
2b02891ef7
commit
c907c2832e
@ -1,3 +1,9 @@
|
|||||||
|
2008-02-06 Tomas Bzatek <tbzatek@redhat.com>
|
||||||
|
|
||||||
|
* glocalfileoutputstream.c (g_local_file_output_stream_close):
|
||||||
|
Fallback to rename() if link() is not available
|
||||||
|
(when no support on target filesystem)
|
||||||
|
|
||||||
2008-02-06 Michael Natterer <mitch@imendio.com>
|
2008-02-06 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
* gfileinfo.c (g_file_info_get_icon): replace
|
* gfileinfo.c (g_file_info_get_icon): replace
|
||||||
|
@ -209,15 +209,19 @@ g_local_file_output_stream_close (GOutputStream *stream,
|
|||||||
|
|
||||||
if (link (file->priv->original_filename, file->priv->backup_filename) != 0)
|
if (link (file->priv->original_filename, file->priv->backup_filename) != 0)
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR,
|
/* link failed or is not supported, try rename */
|
||||||
G_IO_ERROR_CANT_CREATE_BACKUP,
|
if (rename (file->priv->original_filename, file->priv->backup_filename) != 0)
|
||||||
_("Error creating backup link: %s"),
|
{
|
||||||
g_strerror (errno));
|
g_set_error (error, G_IO_ERROR,
|
||||||
goto err_out;
|
G_IO_ERROR_CANT_CREATE_BACKUP,
|
||||||
|
_("Error creating backup copy: %s"),
|
||||||
|
g_strerror (errno));
|
||||||
|
goto err_out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* If link not supported, just rename... */
|
/* If link not supported, just rename... */
|
||||||
if (!rename (file->priv->original_filename, file->priv->backup_filename) != 0)
|
if (rename (file->priv->original_filename, file->priv->backup_filename) != 0)
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR,
|
g_set_error (error, G_IO_ERROR,
|
||||||
G_IO_ERROR_CANT_CREATE_BACKUP,
|
G_IO_ERROR_CANT_CREATE_BACKUP,
|
||||||
|
Loading…
Reference in New Issue
Block a user