[cmake-commits] hoffman committed encode.c 1.3 1.3.2.1

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Dec 18 15:02:10 EST 2007


Update of /cvsroot/CMake/CMake/Utilities/cmtar
In directory public:/mounts/ram/cvs-serv28246/Utilities/cmtar

Modified Files:
      Tag: CMake-2-4
	encode.c 
Log Message:
ENH: merge in from main tree


Index: encode.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Utilities/cmtar/encode.c,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -d -r1.3 -r1.3.2.1
--- encode.c	30 Dec 2005 15:35:23 -0000	1.3
+++ encode.c	18 Dec 2007 20:02:08 -0000	1.3.2.1
@@ -93,16 +93,16 @@
   if (pathname[strlen(pathname) - 1] != '/' && TH_ISDIR(t))
     strcpy(suffix, "/");
 
-  if (strlen(pathname) > T_NAMELEN && (t->options & TAR_GNU))
+  if (strlen(pathname)+strlen(suffix) >= T_NAMELEN && (t->options & TAR_GNU))
   {
     /* GNU-style long name */
     t->th_buf.gnu_longname = strdup(pathname);
     strncpy(t->th_buf.name, t->th_buf.gnu_longname, T_NAMELEN);
   }
-  else if (strlen(pathname) > T_NAMELEN)
+  else if (strlen(pathname)+ strlen(suffix) >= T_NAMELEN)
   {
     /* POSIX-style prefix field */
-    tmp = strchr(&(pathname[strlen(pathname) - T_NAMELEN - 1]), '/');
+    tmp = strrchr(pathname, '/');
     if (tmp == NULL)
     {
       printf("!!! '/' not found in \"%s\"\n", pathname);
@@ -197,12 +197,14 @@
 th_set_mode(TAR *t, mode_t fmode)
 {
 #ifndef WIN32
+#ifndef __BEOS__
   if (S_ISSOCK(fmode))
   {
     fmode &= ~S_IFSOCK;
     fmode |= S_IFIFO;
   }
 #endif
+#endif
   /* Looks like on windows the st_mode is longer than 8 characters. */
   int_to_oct(fmode & 07777777, (t)->th_buf.mode, 8);
 }



More information about the Cmake-commits mailing list