#include "efivars.h"
#include "fd-util.h"
#include "gpt.h"
+#include "parse-util.h"
#include "string-util.h"
#include "udev.h"
bool is_gpt = false;
static const struct option options[] = {
- { "offset", optional_argument, NULL, 'o' },
+ { "offset", required_argument, NULL, 'o' },
{ "noraid", no_argument, NULL, 'R' },
{}
};
for (;;) {
int option;
- option = getopt_long(argc, argv, "oR", options, NULL);
+ option = getopt_long(argc, argv, "o:R", options, NULL);
if (option == -1)
break;
switch (option) {
case 'o':
- offset = strtoull(optarg, NULL, 0);
+ err = safe_atoi64(optarg, &offset);
+ if (err < 0)
+ goto out;
+ if (offset < 0) {
+ err = -ERANGE;
+ goto out;
+ }
break;
case 'R':
noraid = true;