projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
203913e
)
Fix klibc getopt_long_only() for optional arguments
author
Jens Axboe
<axboe@kernel.dk>
Tue, 18 Oct 2011 11:26:01 +0000
(13:26 +0200)
committer
Jens Axboe
<axboe@kernel.dk>
Tue, 18 Oct 2011 11:26:01 +0000
(13:26 +0200)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/getopt_long.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/getopt_long.c
b/lib/getopt_long.c
index 6e8abc0678d1280f415f9c2d4e20f79778a36982..70894e3281e04f7830cc583c2079affb9c545518 100644
(file)
--- a/
lib/getopt_long.c
+++ b/
lib/getopt_long.c
@@
-126,7
+126,16
@@
int getopt_long_only(int argc, char *const *argv, const char *optstring,
} else {
/* Argument-taking option with non-attached
argument */
- if (argv[optind + 1]) {
+ if (osptr[2] == ':') {
+ if (argv[optind + 1]) {
+ optarg = (char *)argv[optind+1];
+ optind += 2;
+ } else {
+ optarg = NULL;
+ optind++;
+ }
+ return opt;
+ } else if (argv[optind + 1]) {
optarg = (char *)argv[optind+1];
optind += 2;
} else {