gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r24648 - in gnunet-gtk: . src/setup


From: gnunet
Subject: [GNUnet-SVN] r24648 - in gnunet-gtk: . src/setup
Date: Wed, 31 Oct 2012 23:33:55 +0100

Author: grothoff
Date: 2012-10-31 23:33:55 +0100 (Wed, 31 Oct 2012)
New Revision: 24648

Modified:
   gnunet-gtk/configure.ac
   gnunet-gtk/src/setup/gnunet-setup.c
Log:
-fix gnunet-user home directory detection

Modified: gnunet-gtk/configure.ac
===================================================================
--- gnunet-gtk/configure.ac     2012-10-31 21:57:57 UTC (rev 24647)
+++ gnunet-gtk/configure.ac     2012-10-31 22:33:55 UTC (rev 24648)
@@ -117,6 +117,8 @@
 
 AC_CHECK_HEADERS([errno.h stdio.h unistd.h locale.h sys/stat.h sys/types.h 
langinfo.h libintl.h unistd.h stddef.h argz.h sys/socket.h netinet/in.h 
stdarg.h])
 
+AC_CHECK_FUNCS([getpwnam])
+
 GNUNET_FS_APP=""
 AC_ARG_ENABLE([fs-app],
    AS_HELP_STRING([--disable-fs-app],[Do not build gnunet-fs-gtk application]))

Modified: gnunet-gtk/src/setup/gnunet-setup.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup.c 2012-10-31 21:57:57 UTC (rev 24647)
+++ gnunet-gtk/src/setup/gnunet-setup.c 2012-10-31 22:33:55 UTC (rev 24648)
@@ -514,7 +514,25 @@
        GNUNET_DISK_file_test ("/etc/gnunet.conf"))
       (void) GNUNET_CONFIGURATION_load (cfg, "/etc/gnunet.conf");
     else
-      (void) GNUNET_CONFIGURATION_load (cfg, "~gnunet/.gnunet/gnunet.conf");
+    {
+#if HAVE_GETPWNAM
+      struct passwd *pw;
+
+      pw = getpwnam ("gnunet");
+      if (NULL != pw)
+      {
+       char *cfgname;
+
+       GNUNET_asprintf (&cfgname,
+                        "%s%s%s",
+                        pw->pw_dir,
+                        DIR_SEPARATOR_STR,
+                        ".gnunet/gnunet.conf");
+       (void) GNUNET_CONFIGURATION_load (cfg, cfgname);
+       GNUNET_free (cfgname);
+      }
+#endif
+    }
     (void) GNUNET_CONFIGURATION_parse (cfg, cfgName);
   }
   else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]