- --- a/wsd.c 2018-07-24
- +++ b/wsd.c 2018-09-10
- @@ -96,13 +96,19 @@ static void uuid_endpoint(char *uuid, si
- {
- FILE *fp = fopen("/etc/machine-id", "r");
- int c, i = 0;
- +
- + if (!fp) {
- + fp = fopen("/proc/sys/kernel/random/boot_id", "r");
- + }
-
- - if (!fp)
- + if (!fp) {
- + DEBUG(0, W, "Can't open required '/etc/machine-id' or '/proc/sys/kernel/random/boot_id'");
- return;
- + }
-
- while (i < 36 && (c = getc(fp)) != EOF &&
- - (isdigit(c) || (islower(c) && isxdigit(c)))) {
- - if (i == 8 || i == 13 || i == 18 || i == 23)
- + ((c == '-') || isdigit(c) || (islower(c) && isxdigit(c)))) {
- + if ((c != '-') && (i == 8 || i == 13 || i == 18 || i == 23))
- uuid[i++] = '-';
- uuid[i++] = c;
- }
|