diff --git a/ChangeLog b/ChangeLog index 244b8b67..3f242bd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index ba793716..5f7d2d99 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -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"); diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index bd16aa27..0009a9a0 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -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]); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index d3e51710..688842db 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -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; diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index eace377e..c9a565b0 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -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++; diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 3a9e619d..1e94b9b0 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -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++;