[gegl] gegl: Make gegl_tile_backend_file_constructor() try O_RDONLY



commit 46ec83f1433dc73f47e4964e87dcd74253d34472
Author: Martin Nordholts <martinn src gnome org>
Date:   Tue May 3 21:00:10 2011 +0200

    gegl: Make gegl_tile_backend_file_constructor() try O_RDONLY
    
    With the GIO code we had a workaround for make distcheck. Port that
    workaround to the non-GIO code path we now use.

 gegl/buffer/gegl-tile-backend-file.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-backend-file.c b/gegl/buffer/gegl-tile-backend-file.c
index 5ffbf39..97b692c 100644
--- a/gegl/buffer/gegl-tile-backend-file.c
+++ b/gegl/buffer/gegl-tile-backend-file.c
@@ -869,7 +869,17 @@ gegl_tile_backend_file_constructor (GType                  type,
 
       self->o = open (self->path, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
       if (self->o == -1)
-        g_warning ("%s: Could not open '%s': %s", G_STRFUNC, self->path, g_strerror (errno));
+        {
+          /* Try again but this time with only read access. This is
+           * a quick-fix for make distcheck, where img_cmp fails
+           * when it opens a GeglBuffer file in the source tree
+           * (which is read-only).
+           */
+          self->o = open (self->path, O_RDONLY, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
+
+          if (self->o == -1)
+            g_warning ("%s: Could not open '%s': %s", G_STRFUNC, self->path, g_strerror (errno));
+        }
       self->i = dup (self->o);
 
       self->header = gegl_buffer_read_header (self->i, &offset)->header;



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