Imported Debian patch 0.5.3-1
[debian/efibootmgr] / src / efibootmgr / efibootmgr.c
index 5058f922baaad4c1dab4e5e1873ed62e12c6936e..7aeb1868e0e9bc7e1e780b92a6b3ab0fbd68a895 100644 (file)
@@ -96,6 +96,18 @@ fill_var(efi_variable_t *var, const char *name)
                | EFI_VARIABLE_RUNTIME_ACCESS;
 }
 
+static void
+free_vars(list_t *head)
+{
+       list_t *pos, *n;
+       var_entry_t *boot;
+
+       list_for_each_safe(pos, n, head) {
+               boot = list_entry(pos, var_entry_t, list);
+               list_del(&(boot->list));
+               free(boot);
+       }
+}
 
 static void
 read_vars(struct dirent **namelist,
@@ -750,6 +762,7 @@ usage()
        printf("\t-v | --verbose          print additional information\n");
        printf("\t-V | --version          return version and exit\n");
        printf("\t-w | --write-signature  write unique sig to MBR if needed\n");
+       printf("\t-@ | --append-binary-args file  append extra args from file (use \"-\" for stdin)\n");
 }
 
 static void
@@ -809,17 +822,21 @@ parse_opts(int argc, char **argv)
                        {"verbose",          optional_argument, 0, 'v'},
                        {"version",                no_argument, 0, 'V'},
                        {"write-signature",        no_argument, 0, 'w'},
+                       {"append-binary-args", required_argument, 0, '@'},
                        {0, 0, 0, 0}
                };
 
                c = getopt_long (argc, argv,
-                                "AaBb:cd:e:E:gH:i:l:L:n:No:Op:qt:TuU:v::Vw",
+                                "AaBb:cd:e:E:gH:i:l:L:n:No:Op:qt:TuU:v::Vw@:",
                                 long_options, &option_index);
                if (c == -1)
                        break;
 
                switch (c)
                {
+               case '@':
+                       opts.extra_opts_file = optarg;
+                       break;
                case 'a':
                        opts.active = 1;
                        break;
@@ -1027,6 +1044,7 @@ main(int argc, char **argv)
                }
        }
        free_dirents(boot_names, num_boot_names);
+       free_vars(&boot_entry_list);
        return 0;
 }