blob: 033ec19e96174a40a09b6cbd1a75d1076640e312 (
plain)
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
32
|
--- name.c.orig Thu Apr 10 04:41:48 1997
+++ name.c Wed Oct 29 12:11:01 1997
@@ -58,6 +58,7 @@
const char * pnt;
int priority = 32767;
char * result;
+ char * copy;
int seen_dot = 0;
int seen_semic = 0;
int tildes = 0;
@@ -105,13 +106,17 @@
last_dot = strrchr (pnt,'.');
if( (last_dot != NULL)
&& ( (last_dot[1] == '~')
- || (last_dot[1] == '\0')
|| (last_dot[1] == '\0')) )
{
- c = last_dot;
- *c = '\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,'.');
+ *last_dot = '\0';
last_dot = strrchr (pnt,'.');
- *c = '.';
}
while(*pnt)
|