You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
695 B

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