From e6d875ff19ba7f23e68a2131d9abe2de3f39d001 Mon Sep 17 00:00:00 2001 From: Natanael Copa 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