-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
musl-use-srand48.patch
40 lines (36 loc) · 1.31 KB
/
musl-use-srand48.patch
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
--- shared/n-dhcp4/src/n-dhcp4-c-probe.c.orig 2020-01-06 15:35:10.128600647 +0100
+++ shared/n-dhcp4/src/n-dhcp4-c-probe.c 2020-01-06 15:39:41.446240531 +0100
@@ -362,7 +362,12 @@ static void n_dhcp4_client_probe_config_
seed16v[1] = (u64 >> 16) ^ (u64 >> 0);
seed16v[2] = (u64 >> 32) ^ (u64 >> 16);
+#ifdef __GLIBC__
r = seed48_r(seed16v, &config->entropy);
+#else
+ r = 0;
+ seed48(seed16v);
+#endif
c_assert(!r);
}
@@ -379,7 +384,12 @@ uint32_t n_dhcp4_client_probe_config_get
long int result;
int r;
+#ifdef __GLIBC__
r = mrand48_r(&config->entropy, &result);
+#else
+ r = 0;
+ result = mrand48();
+#endif
c_assert(!r);
return result;
--- shared/n-dhcp4/src/n-dhcp4-private.h.orig 2020-01-06 15:41:31.941501136 +0100
+++ shared/n-dhcp4/src/n-dhcp4-private.h 2020-01-06 15:41:55.341556325 +0100
@@ -267,7 +267,9 @@ struct NDhcp4ClientProbeConfig {
bool inform_only;
bool init_reboot;
struct in_addr requested_ip;
+#ifdef __GLIBC__
struct drand48_data entropy; /* entropy pool */
+#endif
uint64_t ms_start_delay; /* max ms to wait before starting probe */
NDhcp4ClientProbeOption *options[UINT8_MAX + 1];
int8_t request_parameters[UINT8_MAX + 1];