absolute pathname fix
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 29 Dec 2003 23:39:48 +0000 (23:39 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 29 Dec 2003 23:39:48 +0000 (23:39 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@348 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/ltt/tracefile.c

index 0af8976a170b4f6537f5139d63c4bb5e33950b67..ee77b7af2188c82c0b08c288f76626cd6006c1dc 100644 (file)
@@ -365,6 +365,10 @@ void getCpuFileInfo(LttTrace *t, char* cpu)
  *
  *When a trace is closed, all the associated facilities, types and fields
  *are released as well.
+ *
+ * MD : If pathname is already absolute, we do not add current working
+ * directory to it.
+ *
  ****************************************************************************/
 
 void get_absolute_pathname(const char *pathname, char * abs_pathname)
@@ -372,11 +376,19 @@ void get_absolute_pathname(const char *pathname, char * abs_pathname)
   char * ptr, *ptr1;
   size_t size = DIR_NAME_SIZE;
   abs_pathname[0] = '\0';
+
+       if(pathname[0] == '/')
+       {
+    strcat(abs_pathname, pathname);
+               return;
+       }
+
   if(!getcwd(abs_pathname, size)){
     g_warning("Can not get current working directory\n");
     strcat(abs_pathname, pathname);
     return;
   }
+
   strcat(abs_pathname,"/");
   
   ptr = (char*)pathname;
This page took 0.025998 seconds and 4 git commands to generate.