summaryrefslogtreecommitdiff
blob: 00f19536e388902df98729e0b92c9a2650b902f7 (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
33
34
35
36
37
38
39
40
https://sourceforge.net/p/unixtop/bugs/43/

--- a/hash.c
+++ b/hash.c
@@ -1354,7 +1354,7 @@ hash_add_pidthr(hash_table *ht, pidthr_t
     hi->value = value;
 
     /* hash to the bucket */
-    bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % ht->num_buckets)]);
+    bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned long)(key.k_pid)) % ht->num_buckets)]);
 
     /* walk the list to make sure we do not have a duplicate */
     ll = &(bucket->list);
@@ -1408,7 +1408,7 @@ hash_replace_pidthr(hash_table *ht, pidt
     pidthr_t k1;
 
     /* find the bucket */
-    bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % ht->num_buckets)]);
+    bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned long)(key.k_pid)) % ht->num_buckets)]);
 
     /* walk the list until we find the existing item */
     ll = &(bucket->list);
@@ -1460,7 +1460,7 @@ hash_lookup_pidthr(hash_table *ht, pidth
     pidthr_t k1;
 
     result = NULL;
-    if ((bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % ht->num_buckets)])) != NULL)
+    if ((bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned long)(key.k_pid)) % ht->num_buckets)])) != NULL)
     {
 	ll = &(bucket->list);
 	li = LL_FIRST(ll);
@@ -1499,7 +1499,7 @@ hash_remove_pidthr(hash_table *ht, pidth
     pidthr_t k1;
 
     result = NULL;
-    if ((bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % ht->num_buckets)])) != NULL)
+    if ((bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned long)(key.k_pid)) % ht->num_buckets)])) != NULL)
     {
 	ll = &(bucket->list);
 	li = LL_FIRST(ll);