Add files from parent branch HEAD:
[pkgsrc.git] / sysutils / open-vm-tools / patches / patch-by
1 $NetBSD$
2
3 --- lib/hgfs/hgfsUtil.c.orig    2008-08-08 16:01:54.000000000 +0900
4 +++ lib/hgfs/hgfsUtil.c
5 @@ -95,24 +95,19 @@ int
6  HgfsConvertFromNtTimeNsec(struct timespec *unixTime, // OUT: Time in UNIX format
7                           uint64 ntTime) // IN: Time in Windows NT format
8  {
9 -#ifndef VM_X86_64
10     uint32 sec;
11     uint32 nsec;
12  
13     ASSERT(unixTime);
14 -   /* We assume that time_t is 32bit */
15 -   ASSERT_ON_COMPILE(sizeof (unixTime->tv_sec) == 4);
16  
17 -   /* Cap NT time values that are outside of Unix time's range */
18 -
19 -   if (ntTime >= UNIX_S32_MAX) {
20 -      unixTime->tv_sec = 0x7FFFFFFF;
21 -      unixTime->tv_nsec = 0;
22 -      return 1;
23 -   }
24 -#else
25 -   ASSERT(unixTime);
26 -#endif
27 +   if (sizeof(unixTime->tv_sec) == 4) {
28 +       /* Cap NT time values that are outside of Unix time's range */
29 +       if (ntTime >= UNIX_S32_MAX) {
30 +         unixTime->tv_sec = 0x7FFFFFFF;
31 +         unixTime->tv_nsec = 0;
32 +         return 1;
33 +       }
34 +    }
35  
36     if (ntTime < UNIX_EPOCH) {
37        unixTime->tv_sec = 0;
38 @@ -120,14 +115,14 @@ HgfsConvertFromNtTimeNsec(struct timespe
39        return -1;
40     }
41  
42 -#ifndef VM_X86_64
43 -   Div643232(ntTime - UNIX_EPOCH, 10000000, &sec, &nsec);
44 -   unixTime->tv_sec = sec;
45 -   unixTime->tv_nsec = nsec * 100;
46 -#else
47 -   unixTime->tv_sec = (ntTime - UNIX_EPOCH) / 10000000;
48 -   unixTime->tv_nsec = ((ntTime - UNIX_EPOCH) % 10000000) * 100;
49 -#endif
50 +   if (sizeof(unixTime->tv_sec) == 4) {
51 +       Div643232(ntTime - UNIX_EPOCH, 10000000, &sec, &nsec);
52 +       unixTime->tv_sec = sec;
53 +       unixTime->tv_nsec = nsec * 100;
54 +   } else {
55 +       unixTime->tv_sec = (ntTime - UNIX_EPOCH) / 10000000;
56 +       unixTime->tv_nsec = ((ntTime - UNIX_EPOCH) % 10000000) * 100;
57 +   }
58  
59     return 0;
60  }