[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3079 - GNUnet/src/util/os
From: |
moon |
Subject: |
[GNUnet-SVN] r3079 - GNUnet/src/util/os |
Date: |
Fri, 30 Jun 2006 10:32:15 -0700 (PDT) |
Author: moon
Date: 2006-06-30 10:32:12 -0700 (Fri, 30 Jun 2006)
New Revision: 3079
Modified:
GNUnet/src/util/os/installpath.c
Log:
ooops!
+ cleaning ../ in path
Modified: GNUnet/src/util/os/installpath.c
===================================================================
--- GNUnet/src/util/os/installpath.c 2006-06-30 15:18:10 UTC (rev 3078)
+++ GNUnet/src/util/os/installpath.c 2006-06-30 17:32:12 UTC (rev 3079)
@@ -111,6 +111,18 @@
if( !getcwd(tmp, PATH_TRY-1) ) { /* buffer too small */
tmp = REALLOC(tmp, path_max);
getcwd(tmp, path_max-1); }
+
+ if( (*path1 == '.') && (*(path1+1) == '.') ) { /* ../ so go one level
higher */
+ ptr = strchr(tmp, '/');
+ *ptr = '\0';
+ path2 = path1+3; } /* and jump */
+ else if( (*path1 == '.')) ) {/* ./ so just jump */
+ path2 = path1+2;
+ else
+ path2 = path1;
+
+ if(tmp[len(tmp)-1] == '/') /* just to clean final '/' */
+ tmp[len(tmp)-1] = '\0'
execpath = MALLOC(strlen(tmp)+strlen(path1)+2);
sprintf(execpath, "%s/%s", tmp, path1);
@@ -242,8 +254,7 @@
default:
return NULL; }
- /* if an error occurs here, we won't be able to continue */
- GE_ASSERT(ectx, (tmp = MALLOC(strlen(prefix)+strlen(dirname))) );
+ tmp = MALLOC(strlen(prefix)+strlen(dirname)+1);
final_dir = STRDUP(tmp);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3079 - GNUnet/src/util/os,
moon <=