Fix incorrect getopt_long() usage: converted argv[optind-1] to optarg

so utilities won't do bogus and unexpected things

(Logical change 1.366)
edge.strict_endians
elisa-laajakaista.fi!szaka 2004-04-15 00:42:33 +00:00
parent 8d343b3eec
commit 8c67ce1c36
6 changed files with 13 additions and 11 deletions

View File

@ -9,6 +9,8 @@ xx/xx/2004 - 1.9.2-WIP
endianness support on Cygwin. (Yuval)
- ntfsclone --metadata also saves at least the first 8 KiB of the
$LogFile (Szaka)
- Fix incorrect getopt_long() usage: converted argv[optind-1] to optarg
so utilities won't do bogus and unexpected things (Szaka)
05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates.
- Update with SuSE 9.1 beta 1 versions of GNU build system.

View File

@ -135,7 +135,7 @@ int parse_options (int argc, char **argv)
case 'a':
if (opts.attr != (ATTR_TYPES)-1)
Eprintf("You must specify exactly one attribute.\n");
else if (utils_parse_size(argv[optind-1], &attr, FALSE)) {
else if (utils_parse_size(optarg, &attr, FALSE)) {
opts.attr = (ATTR_TYPES)attr;
break;
} else
@ -153,7 +153,7 @@ int parse_options (int argc, char **argv)
case 'i':
if (opts.inode != -1)
Eprintf("You must specify exactly one inode.\n");
else if (utils_parse_size(argv[optind-1], &opts.inode, FALSE))
else if (utils_parse_size(optarg, &opts.inode, FALSE))
break;
else
Eprintf("Couldn't parse inode number.\n");

View File

@ -249,7 +249,7 @@ static void parse_options(int argc, char **argv)
case 'o':
if (opt.output)
usage();
opt.output = argv[optind-1];
opt.output = optarg;
break;
default:
err_printf("Unknown option '%s'.\n", argv[optind-1]);

View File

@ -172,7 +172,7 @@ int parse_options (int argc, char *argv[])
break;
case 'i':
if ((opts.inode != -1) ||
(!utils_parse_size (argv[optind-1], &opts.inode, FALSE))) {
(!utils_parse_size (optarg, &opts.inode, FALSE))) {
err++;
}
break;

View File

@ -327,7 +327,7 @@ int parse_options (int argc, char *argv[])
break;
case 'c':
if (opts.mode == MODE_NONE) {
if (!utils_parse_range (argv[optind-1],
if (!utils_parse_range (optarg,
&opts.mft_begin, &opts.mft_end, TRUE))
err++;
opts.mode = MODE_COPY;
@ -337,7 +337,7 @@ int parse_options (int argc, char *argv[])
break;
case 'd':
if (!opts.dest)
opts.dest = argv[optind-1];
opts.dest = optarg;
else
err++;
break;
@ -350,7 +350,7 @@ int parse_options (int argc, char *argv[])
break;
case 'm':
if (!opts.match) {
if (!transform (argv[optind-1], &opts.match))
if (!transform (optarg, &opts.match))
err++;
} else {
err++;
@ -358,7 +358,7 @@ int parse_options (int argc, char *argv[])
break;
case 'o':
if (!opts.output) {
opts.output = argv[optind-1];
opts.output = optarg;
} else {
err++;
}
@ -384,14 +384,14 @@ int parse_options (int argc, char *argv[])
break;
case 'S':
if ((opts.size_begin > 0) || (opts.size_end > 0) ||
!utils_parse_range (argv[optind-1], &opts.size_begin,
!utils_parse_range (optarg, &opts.size_begin,
&opts.size_end, TRUE)) {
err++;
}
break;
case 't':
if (opts.since == 0) {
if (!parse_time (argv[optind-1], &opts.since))
if (!parse_time (optarg, &opts.since))
err++;
} else {
err++;

View File

@ -224,7 +224,7 @@ int parse_options (int argc, char *argv[])
break;
case 'b':
if (!opts.bytes) {
if (!parse_list (argv[optind-1], &opts.bytes))
if (!parse_list (optarg, &opts.bytes))
err++;
} else {
err++;