Skip to content

Commit 6b6a55c

Browse files
parport0ldv-alt
authored andcommitted
Mpersify parser of utime syscall
Fix multiple personalities support in parser of utime syscall by using mpersified utimbuf_t typedef. * utime.c (utimbuf_t): New typedef. Mpersify it. (sys_utime): Use it instead of a locally defined union.
1 parent 78e48eb commit 6b6a55c

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

utime.c

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
11
#include "defs.h"
22

3+
#include DEF_MPERS_TYPE(utimbuf_t)
4+
5+
#include <utime.h>
6+
7+
typedef struct utimbuf utimbuf_t;
8+
9+
#include MPERS_DEFS
10+
311
SYS_FUNC(utime)
412
{
5-
union {
6-
long utl[2];
7-
int uti[2];
8-
long paranoia_for_huge_wordsize[4];
9-
} u;
10-
unsigned wordsize;
13+
utimbuf_t u;
1114

1215
printpath(tcp, tcp->u_arg[0]);
1316
tprints(", ");
14-
15-
wordsize = current_wordsize;
16-
if (umoven_or_printaddr(tcp, tcp->u_arg[1], 2 * wordsize, &u))
17-
;
18-
else if (wordsize == sizeof u.utl[0]) {
19-
tprintf("[%s,", sprinttime(u.utl[0]));
20-
tprintf(" %s]", sprinttime(u.utl[1]));
21-
}
22-
else if (wordsize == sizeof u.uti[0]) {
23-
tprintf("[%s,", sprinttime(u.uti[0]));
24-
tprintf(" %s]", sprinttime(u.uti[1]));
17+
if (!umove_or_printaddr(tcp, tcp->u_arg[1], &u)) {
18+
tprintf("[%s,", sprinttime(u.actime));
19+
tprintf(" %s]", sprinttime(u.modtime));
2520
}
26-
else
27-
tprintf("<decode error: unsupported wordsize %d>",
28-
wordsize);
2921

3022
return RVAL_DECODED;
3123
}

0 commit comments

Comments
 (0)