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.

22 lines
672 B

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