Commit | Line | Data |
---|---|---|
95024494 VS |
1 | David Leverton writes about adventure/crc.c: |
2 | ||
3 | The 'adventure' game from the games-misc/bsd-games-2.13 package crashes | |
4 | when saving the game on AMD64 (and probably other 64-bit systems, but I | |
5 | haven't checked). Find attached to fix this. | |
6 | ||
7 | http://bugs.gentoo.org/show_bug.cgi?id=77032 | |
8 | ||
9 | ||
10 | About utmpentry.c: | |
11 | ||
12 | the utmpx structure defines the ut_tv member a little differently on | |
13 | 64bit hosts so that a 32bit and 64bit structure can be shared. So the | |
14 | ut_tv is a custom 32bit structure rather than the native 64bit timeval | |
15 | structure. Work around is to assign the submembers instead. | |
16 | ||
17 | http://bugs.gentoo.org/show_bug.cgi?id=102667 | |
18 | ||
19 | --- bsd-games/adventure/crc.c | |
20 | +++ bsd-games/adventure/crc.c | |
21 | @@ -134,7 +134,8 @@ | |
22 | if (step >= sizeof(crctab) / sizeof(crctab[0])) | |
23 | step = 0; | |
24 | } | |
25 | - crcval = (crcval << 8) ^ crctab[i]; | |
26 | + /* Mask to 32 bits. */ | |
27 | + crcval = ((crcval << 8) ^ crctab[i]) & 0xffffffff; | |
28 | } | |
29 | - return crcval & 0xffffffff; /* Mask to 32 bits. */ | |
30 | + return crcval; | |
31 | } | |
32 | --- bsd-games/dm/utmpentry.c | |
33 | +++ bsd-games/dm/utmpentry.c | |
34 | @@ -291,7 +291,8 @@ | |
35 | e->line[sizeof(e->line) - 1] = '\0'; | |
36 | (void)strncpy(e->host, up->ut_host, sizeof(up->ut_host)); | |
37 | e->name[sizeof(e->host) - 1] = '\0'; | |
38 | - e->tv = up->ut_tv; | |
39 | + e->tv.tv_sec = up->ut_tv.tv_sec; | |
40 | + e->tv.tv_usec = up->ut_tv.tv_usec; | |
41 | adjust_size(e); | |
42 | } | |
43 | #endif |