Index: /CMT/HEAD/ChangeLog
===================================================================
--- /CMT/HEAD/ChangeLog	(revision 593)
+++ /CMT/HEAD/ChangeLog	(revision 594)
@@ -1,2 +1,7 @@
+2011-12-02    <rybkin@lal.in2p3.fr> 471
+
+	* source/cmt_system.cxx: In class CmtSystem functions, add cmt name into
+	system functions error messages, rename helper function to get_absolute_path
+	
 2011-12-01    <rybkin@lal.in2p3.fr> 470
 
Index: /CMT/HEAD/source/cmt_system.cxx
===================================================================
--- /CMT/HEAD/source/cmt_system.cxx	(revision 593)
+++ /CMT/HEAD/source/cmt_system.cxx	(revision 594)
@@ -58,5 +58,5 @@
   if (NULL == ::getcwd (dir, sizeof (dir)))
     {
-      perror ("getcwd failure");
+      perror ("cmt: getcwd failure");
       return NULL;
     }
@@ -91,5 +91,5 @@
       if (NULL == ::getcwd (buffer, sizeof (buffer)))
 	{
-	  perror ("getcwd failure");
+	  perror ("cmt: getcwd failure");
 	  static const cmt_string empty;
 	  return empty;
@@ -101,4 +101,31 @@
   const char* t = &buffer[0];
   return ((cmt_string) t);
+}
+
+//--------------------------------------------------
+static cmt_string get_absolute_path (const cmt_string& name)
+{
+  cmt_string path;
+  if (CmtSystem::absolute_path (name))
+    {
+      path = name;
+    }
+  else
+    {
+      char buffer[PATH_MAX];
+      if (NULL == ::getcwd (buffer, sizeof (buffer)))
+	{
+	  perror ("cmt: getcwd failure");
+	  path = name;
+	}
+      else
+	{
+	  path += buffer;
+	  path += CmtSystem::file_separator ();
+	  path += name;
+	}
+    }
+  CmtSystem::compress_path (path);
+  return path;
 }
 
@@ -140,5 +167,5 @@
 #endif
 	  )
-	perror ("chdir failure: " + s_dir);
+	perror ("cmt: chdir failure: " + get_absolute_path (s_dir));
       return (false);
     }
@@ -297,27 +324,4 @@
 
 //--------------------------------------------------
-static cmt_string get_full_path (const cmt_string& name)
-{
-  cmt_string path;
-  if (CmtSystem::absolute_path (name)) return name;
-  else
-    {
-      char buffer[PATH_MAX];
-      if (NULL == ::getcwd (buffer, sizeof (buffer)))
-	{
-	  perror ("getcwd failure");
-	  path = name;
-	}
-      else
-	{
-	  path += buffer;
-	  path += CmtSystem::file_separator ();
-	  path += name;
-	}
-    }
-  return path;
-}
-
-//--------------------------------------------------
 bool CmtSystem::realpath_ (const cmt_string& path, cmt_string& result)
 {
@@ -332,5 +336,5 @@
       if (NULL == ::getcwd (buffer, sizeof (buffer)))
 	{
-	  perror ("getcwd failure: " + get_full_path (path));
+	  perror ("cmt: getcwd failure: " + get_absolute_path (path));
 	  return false;
 	}
@@ -420,6 +424,6 @@
       if (errno != ENOENT)
 	{
-	  perror ("stat failure: " + get_full_path (name));
-	  CmtError::set (CmtError::file_access_error, get_full_path (name));
+	  perror ("cmt: stat failure: " + get_absolute_path (name));
+	  CmtError::set (CmtError::file_access_error, get_absolute_path (name));
 	}
       return (false);
@@ -450,6 +454,6 @@
       if (errno != ENOENT)
 	{
-	  perror ("stat failure: " + get_full_path (name));
-	  CmtError::set (CmtError::file_access_error, get_full_path (name));
+	  perror ("cmt: stat failure: " + get_absolute_path (name));
+	  CmtError::set (CmtError::file_access_error, get_absolute_path (name));
 	}
       return (false);
@@ -478,6 +482,6 @@
       if (errno != ENOENT)
 	{
-	  perror ("stat failure: " + get_full_path (name1));
-	  CmtError::set (CmtError::file_access_error, get_full_path (name1));
+	  perror ("cmt: stat failure: " + get_absolute_path (name1));
+	  CmtError::set (CmtError::file_access_error, get_absolute_path (name1));
 	}
       return (false);
@@ -497,6 +501,6 @@
       if (errno != ENOENT)
 	{
-	  perror ("stat failure: " + get_full_path (name2));
-	  CmtError::set (CmtError::file_access_error, get_full_path (name2));
+	  perror ("cmt: stat failure: " + get_absolute_path (name2));
+	  CmtError::set (CmtError::file_access_error, get_absolute_path (name2));
 	}
       return (false);
@@ -594,5 +598,5 @@
     {
       if (errno != ENOENT)
-	perror ("stat failure: " + get_full_path (name1));
+	perror ("cmt: stat failure: " + get_absolute_path (name1));
       // name1 does not exist
       return (false);
@@ -628,6 +632,5 @@
 	      else
 		{
-		  if (errno != ENOENT)
-		    perror ("unlink failure: " + get_full_path (name1));
+		  perror ("cmt: unlink failure: " + get_absolute_path (name1));
 		  return (false);
 		}
@@ -639,5 +642,5 @@
       if (errno != ENOENT)
 	{
-	  perror ("stat failure: " + get_full_path (name2));
+	  perror ("cmt: stat failure: " + get_absolute_path (name2));
 	  return (false);
 	}
@@ -658,10 +661,6 @@
       else
 	{
-	  if (errno != ENOENT)
-	    {
-	      perror ("unlink failure: " + get_full_path (name1));
-	      return (false);
-	    }
-	  return (true);
+	  perror ("cmt: unlink failure: " + get_absolute_path (name1));
+	  return (false);
 	}
     }
@@ -692,6 +691,6 @@
       if (errno != ENOENT)
 	{
-	  perror ("stat failure: " + get_full_path (name));
-	  return (-1);
+	  perror ("cmt: stat failure: " + get_absolute_path (name));
+	  return -1;
 	}
       return (0);
@@ -784,5 +783,5 @@
       && errno != ENOENT)
     {
-      perror ("unlink failure: " + get_full_path (newname));
+      perror ("cmt: unlink failure: " + get_absolute_path (newname));
       return (false);
     }
@@ -798,5 +797,5 @@
     {
 #ifndef WIN32
-      perror ("symlink failure: " + newname + "->" + oldname);
+      perror ("cmt: symlink failure: " + newname + "->" + oldname);
 #endif
       return (false);
@@ -816,5 +815,5 @@
       //      cerr << "#CMT> Cannot remove file " << name << endl;
       if (errno != ENOENT)
-	perror ("unlink failure: " + get_full_path (name));
+	perror ("cmt: unlink failure: " + get_absolute_path (name));
       return (false);
     }
@@ -849,5 +848,5 @@
   if (status != 0)
     {
-      perror ("rmdir failure: " + name);
+      perror ("cmt: rmdir failure: " + get_absolute_path (name));
       char num[32]; sprintf (num, "%d", errno);
       CmtMessage::error ("Cannot remove directory " + name + " errno=" + num);
@@ -913,5 +912,5 @@
             {
 	      // cerr << "CMT> cannot create directory " << full_path << endl;
-	      perror ("mkdir failure: " + full_path);
+	      perror ("cmt: mkdir failure: " + full_path);
               return (false);
             }
@@ -1311,5 +1310,5 @@
   else
     {
-      perror ("uname failure");
+      perror ("cmt: uname failure");
     }
 
@@ -1361,5 +1360,5 @@
   if ((ptr = ::tmpnam (NULL)) == NULL)
     {
-      perror ("tmpnam failure");
+      perror ("cmt: tmpnam failure");
       static const cmt_string empty;
       return empty;
@@ -1498,5 +1497,5 @@
 	CmtMessage::error ("putenv failure: " + v);
 #else
-	perror ("putenv failure: " + v);
+	perror ("cmt: putenv failure: " + v);
 #endif
 	return (false);
@@ -1841,5 +1840,5 @@
       if (status == -1) // error reported by pclose ()
 	{
-	  perror ("pclose failure");
+	  perror ("cmt: pclose failure");
 	  if (errno == ECHILD)
 	    {
