[gegl] buffer: fix warning about unused return value



commit 1867c7802666239b4e86247b024354490661abb0
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Wed Sep 18 04:37:08 2013 -0700

    buffer: fix warning about unused return value
    
    Failing to resize the file is unrecoverable, so GEGL will probably
    crash shortly after it happens. But now it will theoretically print
    out why it's about to crash and GCC will stop complaining.

 gegl/buffer/gegl-tile-backend-file-async.c |    3 ++-
 gegl/buffer/gegl-tile-backend-swap.c       |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-backend-file-async.c b/gegl/buffer/gegl-tile-backend-file-async.c
index e3a76b8..92ed5de 100644
--- a/gegl/buffer/gegl-tile-backend-file-async.c
+++ b/gegl/buffer/gegl-tile-backend-file-async.c
@@ -271,7 +271,8 @@ gegl_tile_backend_file_writer_thread (gpointer ignored)
           gegl_tile_backend_file_write (params);
           break;
         case OP_TRUNCATE:
-          ftruncate (params->file->o, params->length);
+          if (ftruncate (params->file->o, params->length) != 0)
+            g_warning ("failed to resize file: %s", g_strerror (errno));
           break;
         case OP_SYNC:
           fsync (params->file->o);
diff --git a/gegl/buffer/gegl-tile-backend-swap.c b/gegl/buffer/gegl-tile-backend-swap.c
index bc2fd7e..3f3b644 100644
--- a/gegl/buffer/gegl-tile-backend-swap.c
+++ b/gegl/buffer/gegl-tile-backend-swap.c
@@ -261,7 +261,8 @@ gegl_tile_backend_swap_writer_thread (gpointer ignored)
           gegl_tile_backend_swap_write (params);
           break;
         case OP_TRUNCATE:
-          ftruncate (out_fd, total);
+          if (ftruncate (out_fd, total) != 0)
+            g_warning ("failed to resize swap file: %s", g_strerror (errno));
           break;
         }
 



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