registry: handle fsync interrupted by signal (EINTR)
authorPeter Seiderer <ps.report@gmx.net>
Thu, 12 Dec 2019 10:37:56 +0000 (11:37 +0100)
committerPeter Seiderer <ps.report@gmx.net>
Thu, 12 Dec 2019 19:49:36 +0000 (20:49 +0100)
According to [1] EINTR is a possible errno for fsync(),
so handle it as all other EINTR (do/while(errno == EINTR)).

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
gst/gstregistrybinary.c

index 2e6451b821cf08a5e4a9b39c4ada3b296a225db8..7c47958bef6ca8146187751d4abfbcf071f24444 100644 (file)
@@ -241,9 +241,16 @@ gst_registry_binary_cache_write (BinaryRegistryCache * cache,
 static gboolean
 gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
 {
+  gint fsync_ret;
+
   /* only fsync if we're actually going to use and rename the file below */
-  if (success && fsync (cache->cache_fd) < 0)
-    goto fsync_failed;
+  if (success) {
+    do {
+      fsync_ret = fsync (cache->cache_fd);
+    } while (fsync_ret < 0 && errno == EINTR);
+    if (fsync_ret)
+      goto fsync_failed;
+  }
 
   if (close (cache->cache_fd) < 0)
     goto close_failed;