diff --git a/gio/ChangeLog b/gio/ChangeLog index 7534e9494..6f05953f4 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,9 @@ +2008-02-06 Tomas Bzatek + + * 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 * gfileinfo.c (g_file_info_get_icon): replace diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c index 38def6583..c0888576b 100644 --- a/gio/glocalfileoutputstream.c +++ b/gio/glocalfileoutputstream.c @@ -209,15 +209,19 @@ g_local_file_output_stream_close (GOutputStream *stream, if (link (file->priv->original_filename, file->priv->backup_filename) != 0) { - g_set_error (error, G_IO_ERROR, - G_IO_ERROR_CANT_CREATE_BACKUP, - _("Error creating backup link: %s"), - g_strerror (errno)); - goto err_out; + /* link failed or is not supported, try rename */ + if (rename (file->priv->original_filename, file->priv->backup_filename) != 0) + { + g_set_error (error, G_IO_ERROR, + G_IO_ERROR_CANT_CREATE_BACKUP, + _("Error creating backup copy: %s"), + g_strerror (errno)); + goto err_out; + } } #else /* 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_IO_ERROR_CANT_CREATE_BACKUP,