The parsing of the "mount -l" was wrong.
No break was on finding the proper line.
Only works if the "efivarfs" line was last.

diff -ur efitools-1.4.2/lib/kernel_efivars.c
efitools-1.4.2/lib/kernel_efivars.c---
efitools-1.4.2/lib/kernel_efivars.c+++
efitools-1.4.2/lib/kernel_efivars.c@@ -44,7 +44,6 @@
        /* hopefully stderr said what was wrong */
        exit(1);
    fd = open(fname, O_RDONLY);-   unlink(fname);
    if (fd < 0) {
        fprintf(stderr, "Failed to open output of %s\n", cmdline);
        exit(1);@@ -60,6 +59,7 @@
    buf = malloc(st.st_size);
    read(fd, buf, st.st_size);
    close(fd);+   unlink(fname);

    char *ptr = buf;
    char path[512], type[512];@@ -68,15 +68,14 @@

        sscanf(ptr, "%*s on %s type %s %*s\n%n", path, type, &count);
        ptr += count;-       if (strcmp(type, "efivarfs") != 0)-
    continue;-   }-   if (strcmp(type, "efivarfs") != 0) {-
fprintf(stderr, "No efivarfs filesystem is mounted\n");-
exit(1);+       if (strcmp(type, "efivarfs") == 0)+       {+
kernel_efi_path = strdup(path);+           return;+       }
    }-   kernel_efi_path = malloc(strlen(path) + 1);-
strcpy(kernel_efi_path, path);+   fprintf(stderr, "No efivarfs
filesystem is mounted\n");+   exit(1);
 }

 int

Reply via email to