#ifdef HAVE_LINK
/* create original -> backup link, the original is then renamed over */
- if (unlink (file->priv->backup_filename) != 0 &&
+ if (g_unlink (file->priv->backup_filename) != 0 &&
errno != ENOENT)
{
int errsv = errno;
if (link (file->priv->original_filename, file->priv->backup_filename) != 0)
{
/* link failed or is not supported, try rename */
- if (rename (file->priv->original_filename, file->priv->backup_filename) != 0)
+ if (g_rename (file->priv->original_filename, file->priv->backup_filename) != 0)
{
int errsv = errno;
}
#else
/* If link not supported, just rename... */
- if (rename (file->priv->original_filename, file->priv->backup_filename) != 0)
+ if (g_rename (file->priv->original_filename, file->priv->backup_filename) != 0)
{
int errsv = errno;
goto err_out;
/* tmp -> original */
- if (rename (file->priv->tmp_filename, file->priv->original_filename) != 0)
+ if (g_rename (file->priv->tmp_filename, file->priv->original_filename) != 0)
{
int errsv = errno;
G_IO_ERROR_INVALID_FILENAME,
_("Invalid filename"));
else
- g_set_error (error, G_IO_ERROR,
- g_io_error_from_errno (errsv),
- _("Error opening file '%s': %s"),
- filename, g_strerror (errsv));
+ {
+ char *display_name = g_filename_display_name (filename);
+ g_set_error (error, G_IO_ERROR,
+ g_io_error_from_errno (errsv),
+ _("Error opening file '%s': %s"),
+ display_name, g_strerror (errsv));
+ g_free (display_name);
+ }
return NULL;
}
G_IO_ERROR_INVALID_FILENAME,
_("Invalid filename"));
else
- g_set_error (error, G_IO_ERROR,
- g_io_error_from_errno (errsv),
- _("Error opening file '%s': %s"),
- filename, g_strerror (errsv));
+ {
+ char *display_name = g_filename_display_name (filename);
+ g_set_error (error, G_IO_ERROR,
+ g_io_error_from_errno (errsv),
+ _("Error opening file '%s': %s"),
+ display_name, g_strerror (errsv));
+ g_free (display_name);
+ }
return NULL;
}
if (fd == -1)
{
int errsv = errno;
-
+ char *display_name = g_filename_display_name (filename);
g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv),
_("Error opening file '%s': %s"),
- filename, g_strerror (errsv));
+ display_name, g_strerror (errsv));
+ g_free (display_name);
return -1;
}
if (fstat (fd, &original_stat) != 0)
{
int errsv = errno;
-
+ char *display_name = g_filename_display_name (filename);
g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv),
_("Error stating file '%s': %s"),
- filename, g_strerror (errsv));
+ display_name, g_strerror (errsv));
+ g_free (display_name);
goto err_out;
}
original_stat.st_mode != tmp_statbuf.st_mode)
{
close (tmpfd);
- unlink (tmp_filename);
+ g_unlink (tmp_filename);
g_free (tmp_filename);
goto fallback_strategy;
}
backup_filename = create_backup_filename (filename);
- if (unlink (backup_filename) == -1 && errno != ENOENT)
+ if (g_unlink (backup_filename) == -1 && errno != ENOENT)
{
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR,
G_IO_ERROR_CANT_CREATE_BACKUP,
_("Backup file creation failed"));
- unlink (backup_filename);
+ g_unlink (backup_filename);
g_free (backup_filename);
goto err_out;
}
G_IO_ERROR,
G_IO_ERROR_CANT_CREATE_BACKUP,
_("Backup file creation failed"));
- unlink (backup_filename);
+ g_unlink (backup_filename);
close (bfd);
g_free (backup_filename);
goto err_out;
G_IO_ERROR,
G_IO_ERROR_CANT_CREATE_BACKUP,
_("Backup file creation failed"));
- unlink (backup_filename);
+ g_unlink (backup_filename);
close (bfd);
g_free (backup_filename);
G_IO_ERROR_INVALID_FILENAME,
_("Invalid filename"));
else
- g_set_error (error, G_IO_ERROR,
- g_io_error_from_errno (errsv),
- _("Error opening file '%s': %s"),
- filename, g_strerror (errsv));
+ {
+ char *display_name = g_filename_display_name (filename);
+ g_set_error (error, G_IO_ERROR,
+ g_io_error_from_errno (errsv),
+ _("Error opening file '%s': %s"),
+ display_name, g_strerror (errsv));
+ g_free (display_name);
+ }
return NULL;
}