Description: Use flock on GNU/Hurd for now.
 For some yet to be discovered reason fcntl segfaults there.
Origin: http://git.pwmt.org/?p=zathura.git;a=commit;h=87ef40e3
Last-Update: 2012-03-27

diff --git a/database-plain.c b/database-plain.c
index e10093f..8c6bf13 100644
--- a/database-plain.c
+++ b/database-plain.c
@@ -21,11 +21,16 @@
 #define KEY_SCALE "scale"
 #define KEY_ROTATE "rotate"
 
+#ifdef __GNU__
+#include <sys/file.h>
+#define file_lock_set(fd, cmd) flock(fd, cmd)
+#else
 #define file_lock_set(fd, cmd) \
   { \
   struct flock lock = { .l_type = cmd, .l_start = 0, .l_whence = SEEK_SET, .l_len = 0}; \
   fcntl(fd, F_SETLK, lock); \
   }
+#endif
 
 static void zathura_database_interface_init(ZathuraDatabaseInterface* iface);
 
@@ -441,7 +446,7 @@ zathura_db_read_key_file_from_file(const char* path)
   }
 
   /* open file */
-  FILE* file = fopen(path, "r");
+  FILE* file = fopen(path, "rw");
   if (file == NULL) {
     return NULL;
   }
