aboutsummaryrefslogtreecommitdiff
path: root/src/util/os_installation.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-07-20 20:18:49 +0000
committerChristian Grothoff <christian@grothoff.org>2012-07-20 20:18:49 +0000
commita3aecc1584246fef20413c9b4a6097f2a9f3e64b (patch)
tree781599b992224f49e1c60937a7a4c808ff981e77 /src/util/os_installation.c
parent2687ea5fca3effa07f9b58aa41dfeac203dfb65f (diff)
downloadgnunet-a3aecc1584246fef20413c9b4a6097f2a9f3e64b.tar.gz
gnunet-a3aecc1584246fef20413c9b4a6097f2a9f3e64b.zip
-cleanup
Diffstat (limited to 'src/util/os_installation.c')
-rw-r--r--src/util/os_installation.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index c52628dcd..1e51c1327 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -194,29 +194,26 @@ get_path_from_dyld_image ()
194 const char *path; 194 const char *path;
195 char *p; 195 char *p;
196 char *s; 196 char *s;
197 int i; 197 unsigned int i;
198 int c; 198 int c;
199 199
200 p = NULL;
201 c = _dyld_image_count (); 200 c = _dyld_image_count ();
202 for (i = 0; i < c; i++) 201 for (i = 0; i < c; i++)
203 { 202 {
204 if (_dyld_get_image_header (i) == &_mh_dylib_header) 203 if (_dyld_get_image_header (i) != &_mh_dylib_header)
205 { 204 continue;
206 path = _dyld_get_image_name (i); 205 path = _dyld_get_image_name (i);
207 if ( (NULL != path) && (strlen (path) > 0) ) 206 if ( (NULL == path) || (0 == strlen (path)) )
208 { 207 continue;
209 p = GNUNET_strdup (path); 208 p = GNUNET_strdup (path);
210 s = p + strlen (p); 209 s = p + strlen (p);
211 while ((s > p) && ('/' != *s)) 210 while ((s > p) && ('/' != *s))
212 s--; 211 s--;
213 s++; 212 s++;
214 *s = '\0'; 213 *s = '\0';
215 } 214 return p;
216 break;
217 }
218 } 215 }
219 return p; 216 return NULL;
220} 217}
221#endif 218#endif
222 219
@@ -237,8 +234,7 @@ get_path_from_PATH (const char *binary)
237 char *buf; 234 char *buf;
238 const char *p; 235 const char *p;
239 236
240 p = getenv ("PATH"); 237 if (NULL == (p = getenv ("PATH")))
241 if (NULL == p)
242 return NULL; 238 return NULL;
243#if WINDOWS 239#if WINDOWS
244 /* On W32 look in CWD first. */ 240 /* On W32 look in CWD first. */