[dconf] Simplify 'shmdir' checks
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf] Simplify 'shmdir' checks
- Date: Sun, 3 Jul 2011 15:32:43 +0000 (UTC)
commit 7b99c368158db2f622c1bb01de4bdde62270c2d0
Author: Ryan Lortie <desrt desrt ca>
Date: Sun Jul 3 17:31:12 2011 +0200
Simplify 'shmdir' checks
With XDG_RUNTIME_DIR, we no longer have to be frightened about NFS.
That lets us remove the NFS checks that were causing build failures all
over the place.
common/dconf-shmdir.c | 51 ++++++------------------------------------------
1 files changed, 7 insertions(+), 44 deletions(-)
---
diff --git a/common/dconf-shmdir.c b/common/dconf-shmdir.c
index d87d6d7..cb40e11 100644
--- a/common/dconf-shmdir.c
+++ b/common/dconf-shmdir.c
@@ -21,41 +21,6 @@
#include "dconf-shmdir.h"
-#ifndef __FreeBSD__
-#include <sys/statfs.h>
-#include <sys/vfs.h>
-#endif
-
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <errno.h>
-
-#ifndef NFS_SUPER_MAGIC
-#define NFS_SUPER_MAGIC 0x6969
-#endif
-
-static gboolean
-is_local (const gchar *filename)
-{
- struct statfs buf;
- gint s;
-
- do
- s = statfs (filename, &buf);
- while (s < 0 && errno == EINTR);
-
- if (s < 0 && errno == ENOENT)
- {
- g_mkdir_with_parents (filename, 0700);
-
- do
- s = statfs (filename, &buf);
- while (s < 0 && errno == EINTR);
- }
-
- return s == 0 && buf.f_type != NFS_SUPER_MAGIC;
-}
-
gchar *
dconf_shmdir_from_environment (void)
{
@@ -65,19 +30,17 @@ dconf_shmdir_from_environment (void)
if (result == NULL)
{
- const gchar *cache = g_get_user_cache_dir ();
+ result = g_build_filename (g_get_user_runtime_dir (), "dconf", NULL);
- if (is_local (cache))
+ if (g_mkdir_with_parents (result, 0700) != 0)
{
- result = g_build_filename (cache, "dconf", NULL);
-
- if (g_mkdir_with_parents (result, 0700) != 0)
- {
- g_free (result);
- result = NULL;
- }
+ g_free (result);
+ result = NULL;
}
}
+
+
+
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]