Lines 1-6
Link Here
|
1 |
--- ctm/ctm_pass3.c.orig 2018-10-27 15:56:22 UTC |
1 |
--- ctm/ctm_pass3.c.orig 2018-10-27 15:56:22 UTC |
2 |
+++ ctm/ctm_pass3.c |
2 |
+++ ctm/ctm_pass3.c |
3 |
@@ -35,10 +35,12 @@ Pass3(FILE *fd) |
3 |
@@ -31,14 +31,22 @@ settime(const char *name, const struct timeval *times) |
|
|
4 |
} |
5 |
|
6 |
int |
7 |
+setmodefromchar(const char *name, const u_char *mode) |
8 |
+{ |
9 |
+ return chmod(name, strtol(mode, NULL, 8)); |
10 |
+} |
11 |
+ |
12 |
+int |
13 |
Pass3(FILE *fd) |
4 |
{ |
14 |
{ |
5 |
u_char *p,*q,buf[BUFSIZ]; |
15 |
u_char *p,*q,buf[BUFSIZ]; |
6 |
MD5_CTX ctx; |
16 |
MD5_CTX ctx; |
Lines 15-21
Link Here
|
15 |
struct stat st; |
25 |
struct stat st; |
16 |
char md5_1[33]; |
26 |
char md5_1[33]; |
17 |
int match=0; |
27 |
int match=0; |
18 |
@@ -131,7 +133,7 @@ Pass3(FILE *fd) |
28 |
@@ -131,7 +139,7 @@ Pass3(FILE *fd) |
19 |
WRONG |
29 |
WRONG |
20 |
found: |
30 |
found: |
21 |
for(i=0;(j = sp->List[i]);i++) { |
31 |
for(i=0;(j = sp->List[i]);i++) { |
Lines 24-30
Link Here
|
24 |
sep = ' '; |
34 |
sep = ' '; |
25 |
else |
35 |
else |
26 |
sep = '\n'; |
36 |
sep = '\n'; |
27 |
@@ -149,53 +151,98 @@ Pass3(FILE *fd) |
37 |
@@ -149,53 +157,99 @@ Pass3(FILE *fd) |
28 |
break; |
38 |
break; |
29 |
case CTM_F_Count: GETBYTECNT(cnt,sep); break; |
39 |
case CTM_F_Count: GETBYTECNT(cnt,sep); break; |
30 |
case CTM_F_Bytes: GETDATA(trash,cnt); break; |
40 |
case CTM_F_Bytes: GETDATA(trash,cnt); break; |
Lines 140-145
Link Here
|
140 |
+ WRONG |
150 |
+ WRONG |
141 |
+ } |
151 |
+ } |
142 |
+ if (settime(name,times)) WRONG |
152 |
+ if (settime(name,times)) WRONG |
|
|
153 |
+ if (setmodefromchar(name,mode)) WRONG |
143 |
+ continue; |
154 |
+ continue; |
144 |
} |
155 |
} |
145 |
- if(cnt != write(i,trash,cnt)) { |
156 |
- if(cnt != write(i,trash,cnt)) { |
Lines 159-168
Link Here
|
159 |
if(!strcmp(sp->Key,"FE")) { |
170 |
if(!strcmp(sp->Key,"FE")) { |
160 |
ed = popen("ed","w"); |
171 |
ed = popen("ed","w"); |
161 |
if(!ed) { |
172 |
if(!ed) { |
162 |
@@ -278,6 +325,8 @@ Pass3(FILE *fd) |
173 |
@@ -218,6 +272,7 @@ Pass3(FILE *fd) |
|
|
174 |
WRONG |
163 |
} |
175 |
} |
|
|
176 |
if (settime(name,times)) WRONG |
177 |
+ if (setmodefromchar(name,mode)) WRONG |
164 |
continue; |
178 |
continue; |
165 |
} |
179 |
} |
|
|
180 |
if(!strcmp(sp->Key,"FN")) { |
181 |
@@ -237,6 +292,7 @@ Pass3(FILE *fd) |
182 |
if (rename(buf,name) == -1) |
183 |
WRONG |
184 |
if (settime(name,times)) WRONG |
185 |
+ if (setmodefromchar(name,mode)) WRONG |
186 |
continue; |
187 |
} |
188 |
if(!strcmp(sp->Key,"DM")) { |
189 |
@@ -249,6 +305,7 @@ Pass3(FILE *fd) |
190 |
WRONG |
191 |
} |
192 |
if (settime(name,times)) WRONG |
193 |
+ if (setmodefromchar(name,mode)) WRONG |
194 |
continue; |
195 |
} |
196 |
if(!strcmp(sp->Key,"FR")) { |
197 |
@@ -278,6 +335,8 @@ Pass3(FILE *fd) |
198 |
} |
199 |
continue; |
200 |
} |
166 |
+ if(!strcmp(sp->Key,"TR") || !strcmp(sp->Key,"SV")) |
201 |
+ if(!strcmp(sp->Key,"TR") || !strcmp(sp->Key,"SV")) |
167 |
+ continue; |
202 |
+ continue; |
168 |
WRONG |
203 |
WRONG |