aboutsummaryrefslogtreecommitdiffstats
path: root/main/dconf/0001-Avoid-posix_fallocate-so-it-works-on-uClibc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/dconf/0001-Avoid-posix_fallocate-so-it-works-on-uClibc.patch')
-rw-r--r--main/dconf/0001-Avoid-posix_fallocate-so-it-works-on-uClibc.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/main/dconf/0001-Avoid-posix_fallocate-so-it-works-on-uClibc.patch b/main/dconf/0001-Avoid-posix_fallocate-so-it-works-on-uClibc.patch
new file mode 100644
index 0000000000..5317b39c96
--- /dev/null
+++ b/main/dconf/0001-Avoid-posix_fallocate-so-it-works-on-uClibc.patch
@@ -0,0 +1,36 @@
+From e6d875ff19ba7f23e68a2131d9abe2de3f39d001 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Sat, 9 Oct 2010 20:34:08 +0000
+Subject: [PATCH] Avoid posix_fallocate() so it works on uClibc
+
+It seems like the possix_fallocate() does not need to be provided on
+all implementations (see "Application Usage" in
+http://www.opengroup.org/onlinepubs/009695399/functions/posix_fallocate.html )
+
+I'm not too familiar with the code but it looks like _DConfEngine->shm
+is a mmap to a file with 1 char size. If thats the case then something
+like this would work:
+---
+ engine/dconf-engine.c | 6 +++++-
+ 1 files changed, 5 insertions(+), 1 deletions(-)
+
+diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c
+index cf57431..8eb3fa7 100644
+--- a/engine/dconf-engine.c
++++ b/engine/dconf-engine.c
+@@ -144,7 +144,11 @@ dconf_engine_setup_user (DConfEngine *engine)
+
+ if (fd >= 0)
+ {
+- if (posix_fallocate (fd, 0, 1) == 0)
++ struct stat st;
++ int r = fstat(fd, &st);
++ if (r == 0 && st.st_size == 0)
++ r = write(fd, "", 1);
++ if (r == 0)
+ {
+ engine->shm = mmap (NULL, 1, PROT_READ, MAP_SHARED, fd, 0);
+
+--
+1.7.3.1
+