chiark / gitweb /
bootctl: show "n/a" for empty boot option labels
[elogind.git] / src / boot / boot-efi.c
index a0305ba77dc1afae99abe2af55ed3048dfd6b92a..51f12c0c1a53fe287635ef8ffe2dac6387c8e775 100644 (file)
 #include "efivars.h"
 #include "conf-files.h"
 
+static char *tilt_slashes(char *s) {
+        char *p;
+
+        if (!s)
+                return NULL;
+
+        for (p = s; *p; p++)
+                if (*p == '\\')
+                        *p = '/';
+        return s;
+}
+
 static int get_boot_entries(struct boot_info *info) {
         uint16_t *list;
         int i, n;
@@ -64,6 +76,12 @@ static int get_boot_entries(struct boot_info *info) {
                 if (err < 0)
                         continue;
 
+                if (isempty(e->title)) {
+                        free(e->title);
+                        e->title = NULL;
+                }
+                tilt_slashes(e->path);
+
                 e->id = list[i];
                 info->fw_entries_count++;
         }
@@ -152,6 +170,7 @@ int boot_info_query(struct boot_info *info) {
         efi_get_variable_string(EFI_VENDOR_LOADER, "LoaderFirmwareType", &info->fw_type);
         efi_get_variable_string(EFI_VENDOR_LOADER, "LoaderFirmwareInfo", &info->fw_info);
         efi_get_variable_string(EFI_VENDOR_LOADER, "LoaderImageIdentifier", &info->loader_image_path);
+        tilt_slashes(info->loader_image_path);
         efi_get_loader_device_part_uuid(&info->loader_part_uuid);
 
         boot_loader_read_entries(info);