[tracker] libtracker-data: Check g_rename() return value
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-data: Check g_rename() return value
- Date: Wed, 14 Dec 2016 19:44:12 +0000 (UTC)
commit e7aa8d18b152bc1d38bb3ad845c29c4fcb717f8d
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Dec 14 19:53:26 2016 +0100
libtracker-data: Check g_rename() return value
And error out properly if it fails.
src/libtracker-data/tracker-db-journal.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-journal.c b/src/libtracker-data/tracker-db-journal.c
index d544abf..d82f7ca 100644
--- a/src/libtracker-data/tracker-db-journal.c
+++ b/src/libtracker-data/tracker-db-journal.c
@@ -2138,7 +2138,14 @@ tracker_db_journal_rotate (GError **error)
fullpath = g_strdup_printf ("%s.%d", writer.journal_filename, ++max);
- g_rename (writer.journal_filename, fullpath);
+ if (g_rename (writer.journal_filename, fullpath) < 0) {
+ g_set_error (error, TRACKER_DB_JOURNAL_ERROR,
+ TRACKER_DB_JOURNAL_ERROR_COULD_NOT_WRITE,
+ "Could not rotate journal file %s: %s",
+ writer.journal_filename,
+ g_strerror (errno));
+ return FALSE;
+ }
/* Recalculate progress next time */
rotating_settings.rotate_progress_flag = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]