[tracker] tracker-extract: Check error on posix_fadvise() calls.



commit f0390dcce7a08151360556a340bad0161ecd3669
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 14 20:37:48 2016 +0100

    tracker-extract: Check error on posix_fadvise() calls.

 src/tracker-extract/tracker-extract-mp3.c    |    3 ++-
 src/tracker-extract/tracker-extract-ps.c     |    3 ++-
 src/tracker-extract/tracker-extract-vorbis.c |    3 ++-
 src/tracker-extract/tracker-read.c           |    3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 4f63b74..a29b8d3 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -2318,7 +2318,8 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
        id3v1_buffer = read_id3v1_buffer (fd, size);
 
 #ifdef HAVE_POSIX_FADVISE
-       posix_fadvise (fd, 0, 0, POSIX_FADV_DONTNEED);
+       if (posix_fadvise (fd, 0, 0, POSIX_FADV_DONTNEED) != 0)
+               g_warning ("posix_fadvise() call failed: %m");
 #endif /* HAVE_POSIX_FADVISE */
 
        close (fd);
diff --git a/src/tracker-extract/tracker-extract-ps.c b/src/tracker-extract/tracker-extract-ps.c
index aa3f62f..f360f7e 100644
--- a/src/tracker-extract/tracker-extract-ps.c
+++ b/src/tracker-extract/tracker-extract-ps.c
@@ -294,7 +294,8 @@ extract_ps_gz (const gchar          *uri)
                g_debug ("Extracting compressed PS '%s'...", uri);
                metadata = extract_ps_from_filestream (fz);
 #ifdef HAVE_POSIX_FADVISE
-               posix_fadvise (fdz, 0, 0, POSIX_FADV_DONTNEED);
+               if (posix_fadvise (fdz, 0, 0, POSIX_FADV_DONTNEED) != 0)
+                       g_warning ("posix_fadvise() call failed: %m");
 #endif /* HAVE_POSIX_FADVISE */
                fclose (fz);
        }
diff --git a/src/tracker-extract/tracker-extract-vorbis.c b/src/tracker-extract/tracker-extract-vorbis.c
index 3b2d173..129edd3 100644
--- a/src/tracker-extract/tracker-extract-vorbis.c
+++ b/src/tracker-extract/tracker-extract-vorbis.c
@@ -372,7 +372,8 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
        g_object_unref (md.creator);
 
 #ifdef HAVE_POSIX_FADVISE
-       posix_fadvise (fileno (f), 0, 0, POSIX_FADV_DONTNEED);
+       if (posix_fadvise (fileno (f), 0, 0, POSIX_FADV_DONTNEED) != 0)
+               g_warning ("posix_fadvise() call failed: %m");
 #endif /* HAVE_POSIX_FADVISE */
 
        /* NOTE: This calls fclose on the file */
diff --git a/src/tracker-extract/tracker-read.c b/src/tracker-extract/tracker-read.c
index 32db459..89ae133 100644
--- a/src/tracker-extract/tracker-read.c
+++ b/src/tracker-extract/tracker-read.c
@@ -374,7 +374,8 @@ tracker_read_text_from_fd (gint  fd,
 
        /* Close the file here */
 #ifdef HAVE_POSIX_FADVISE
-       posix_fadvise (fd, 0, 0, POSIX_FADV_DONTNEED);
+       if (posix_fadvise (fd, 0, 0, POSIX_FADV_DONTNEED) != 0)
+               g_warning ("posix_fadvise() call failed: %m");
 #endif /* HAVE_POSIX_FADVISE */
        fclose (fz);
 


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