[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5250 - in GNUnet/src: include util/os
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5250 - in GNUnet/src: include util/os |
Date: |
Fri, 6 Jul 2007 12:31:07 -0600 (MDT) |
Author: grothoff
Date: 2007-07-06 12:31:07 -0600 (Fri, 06 Jul 2007)
New Revision: 5250
Modified:
GNUnet/src/include/platform.h
GNUnet/src/util/os/installpath.c
GNUnet/src/util/os/user.c
Log:
Heikki OS X patches: figure out installation paths and disable useradd
Modified: GNUnet/src/include/platform.h
===================================================================
--- GNUnet/src/include/platform.h 2007-07-05 21:12:30 UTC (rev 5249)
+++ GNUnet/src/include/platform.h 2007-07-06 18:31:07 UTC (rev 5250)
@@ -132,6 +132,7 @@
#include <semaphore.h>
#endif
#ifdef OSX
+#include <dlfcn.h>
#include <semaphore.h>
#include <net/if.h>
#endif
Modified: GNUnet/src/util/os/installpath.c
===================================================================
--- GNUnet/src/util/os/installpath.c 2007-07-05 21:12:30 UTC (rev 5249)
+++ GNUnet/src/util/os/installpath.c 2007-07-06 18:31:07 UTC (rev 5250)
@@ -101,6 +101,43 @@
}
#endif
+#if OSX
+typedef int (*MyNSGetExecutablePathProto)(char *buf, size_t *bufsize);
+
+static char * get_path_from_NSGetExecutablePath() {
+ char *path;
+ char zero = '\0';
+ size_t len;
+ void *func;
+ int ret;
+
+ path = NULL;
+ func = dlsym(RTLD_DEFAULT, "_NSGetExecutablePath");
+ if (func) {
+ path = &zero;
+ len = 0;
+ ret = ((MyNSGetExecutablePathProto)func)(path, &len);
+ if (len == 0)
+ path = NULL;
+ else {
+ len++;
+ path = (char *)MALLOC(len);
+ ret = ((MyNSGetExecutablePathProto)func)(path, &len);
+ if (ret != 0) {
+ FREE(path);
+ path = NULL;
+ }
+ else {
+ while ((path[len] != '/') && (len > 0))
+ len--;
+ path[len] = '\0';
+ }
+ }
+ }
+ return path;
+}
+#endif
+
static char *
get_path_from_PATH() {
char * path;
@@ -174,6 +211,11 @@
if (ret != NULL)
return ret;
#endif
+#if OSX
+ ret = get_path_from_NSGetExecutablePath();
+ if (ret != NULL)
+ return ret;
+#endif
ret = get_path_from_PATH();
if (ret != NULL)
return ret;
Modified: GNUnet/src/util/os/user.c
===================================================================
--- GNUnet/src/util/os/user.c 2007-07-05 21:12:30 UTC (rev 5249)
+++ GNUnet/src/util/os/user.c 2007-07-06 18:31:07 UTC (rev 5250)
@@ -74,6 +74,8 @@
if (IsWinNT())
return CreateServiceAccount(user_name,
"GNUnet service account");
+#elif OSX
+ return SYSERR; /* TODO */
#else
if (ACCESS("/usr/sbin/adduser",
X_OK) == 0) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5250 - in GNUnet/src: include util/os,
gnunet <=