[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22670 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22670 - gnunet/src/util |
Date: |
Sun, 15 Jul 2012 01:12:36 +0200 |
Author: grothoff
Date: 2012-07-15 01:12:36 +0200 (Sun, 15 Jul 2012)
New Revision: 22670
Modified:
gnunet/src/util/os_installation.c
Log:
-code cleanup
Modified: gnunet/src/util/os_installation.c
===================================================================
--- gnunet/src/util/os_installation.c 2012-07-14 23:07:50 UTC (rev 22669)
+++ gnunet/src/util/os_installation.c 2012-07-14 23:12:36 UTC (rev 22670)
@@ -46,6 +46,8 @@
#if LINUX
/**
* Try to determine path by reading /proc/PID/exe
+ *
+ * @return NULL on error
*/
static char *
get_path_from_proc_maps ()
@@ -77,6 +79,8 @@
/**
* Try to determine path by reading /proc/PID/exe
+ *
+ * @return NULL on error
*/
static char *
get_path_from_proc_exe ()
@@ -109,6 +113,8 @@
#if WINDOWS
/**
* Try to determine path with win32-specific function
+ *
+ * @return NULL on error
*/
static char *
get_path_from_module_filename ()
@@ -130,9 +136,21 @@
#endif
#if DARWIN
+/**
+ * Signature of the '_NSGetExecutablePath" function.
+ *
+ * @param buf where to write the path
+ * @param number of bytes available in 'buf'
+ * @return 0 on success, otherwise desired number of bytes is stored in
'bufsize'
+ */
typedef int (*MyNSGetExecutablePathProto) (char *buf, size_t * bufsize);
+/**
+ * Try to obtain the path of our executable using '_NSGetExecutablePath'.
+ *
+ * @return NULL on error
+ */
static char *
get_path_from_NSGetExecutablePath ()
{
@@ -148,7 +166,7 @@
path = &zero;
len = 0;
/* get the path len, including the trailing \0 */
- func (path, &len);
+ (void) func (path, &len);
if (0 == len)
return NULL;
path = GNUNET_malloc (len);
@@ -165,6 +183,11 @@
}
+/**
+ * Try to obtain the path of our executable using '_dyld_image' API.
+ *
+ * @return NULL on error
+ */
static char *
get_path_from_dyld_image ()
{
@@ -252,6 +275,12 @@
}
+/**
+ * Try to obtain the installation path using the "GNUNET_PREFIX" environment
+ * variable.
+ *
+ * @return NULL on error (environment variable not set)
+ */
static char *
get_path_from_GNUNET_PREFIX ()
{
@@ -302,7 +331,8 @@
return NULL;
}
-/*
+
+/**
* @brief get the path to current app's bin/
* @author Milan
*
@@ -330,7 +360,6 @@
}
-
/**
* @brief get the path to a specific GNUnet installation directory or,
* with GNUNET_IPK_SELF_PREFIX, the current running apps installation directory
@@ -500,8 +529,7 @@
}
if (0 != ACCESS (p, X_OK))
{
- LOG (GNUNET_ERROR_TYPE_WARNING, _("access (%s, X_OK) failed: %s\n"), p,
- STRERROR (errno));
+ LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "access", p);
GNUNET_free (p);
return GNUNET_SYSERR;
}
@@ -515,13 +543,12 @@
#endif
if (0 != STAT (p, &statbuf))
{
- LOG (GNUNET_ERROR_TYPE_WARNING, _("stat (%s) failed: %s\n"), p,
- STRERROR (errno));
+ LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", p);
GNUNET_free (p);
return GNUNET_SYSERR;
}
#ifndef MINGW
- if ((0 != (statbuf.st_mode & S_ISUID)) && (statbuf.st_uid == 0))
+ if ((0 != (statbuf.st_mode & S_ISUID)) && (0 == statbuf.st_uid))
{
GNUNET_free (p);
return GNUNET_YES;
@@ -541,7 +568,7 @@
{
DWORD err = GetLastError ();
- LOG (GNUNET_ERROR_TYPE_INFO,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"socket (AF_INET, SOCK_RAW, IPPROTO_ICMP) failed! GLE = %d\n",
err);
once = -1;
return GNUNET_NO; /* not running as administrator */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22670 - gnunet/src/util,
gnunet <=