1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-24 14:50:17 +03:00

random-util: fix compilation error

Fixes the following error:
```
../src/basic/random-util.c: In function "fallback_random_bytes":
../src/basic/random-util.c:45:26: error: initializer-string for array of "char" is too long [-Werror=unterminated-string-initialization]
   45 |                 .label = "systemd fallback random bytes v1",
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
This commit is contained in:
Yu Watanabe 2025-01-16 01:29:04 +09:00 committed by Mike Yuan
parent cc7300fc58
commit e722fe74ca

View File

@ -42,7 +42,6 @@ static void fallback_random_bytes(void *p, size_t n) {
uint8_t auxval[16];
} state = {
/* Arbitrary domain separation to prevent other usage of AT_RANDOM from clashing. */
.label = "systemd fallback random bytes v1",
.call_id = fallback_counter++,
.stamp_mono = now(CLOCK_MONOTONIC),
.stamp_real = now(CLOCK_REALTIME),
@ -50,6 +49,7 @@ static void fallback_random_bytes(void *p, size_t n) {
.tid = gettid(),
};
memcpy(state.label, "systemd fallback random bytes v1", sizeof(state.label));
memcpy(state.auxval, ULONG_TO_PTR(getauxval(AT_RANDOM)), sizeof(state.auxval));
while (n > 0) {