summaryrefslogtreecommitdiff
path: root/sysutils/mkisofs-devel/files/patch-ac
blob: b0ca127e41a8bcfa18aebd546d4dd94a3bdd2127 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- name.c.orig	Sat Mar 15 04:02:46 1997
+++ name.c	Mon Apr 28 11:50:47 1997
@@ -57,6 +57,7 @@
   const char	* pnt;
   int		  priority	   = 32767;
   char		* result;
+  char		* copy;
   int		  seen_dot	   = 0;
   int		  seen_semic	   = 0;
   int		  tildes	   = 0;
@@ -104,12 +105,17 @@
   last_dot = strrchr (pnt,'.');
   if(    (last_dot != NULL)
       && (    (last_dot[1] == '~')
-	   || (last_dot[1] == '\0')
 	   || (last_dot[1] == '\0')) )
     {
+      /*
+       * We gotta copy the string first, to work around its constness.
+       */
+      copy = alloca (strlen(name) + 1);
+      memcpy (copy, name, strlen(name) + 1);
+      pnt = copy;
+      last_dot = strrchr (pnt,'.');
       c = last_dot;
       *c = '\0';
       last_dot = strrchr (pnt,'.');
-      *c = '.';
     }
 
   while(*pnt)