aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorGregory M. Turner <gmt@be-evil.net>2014-02-07 12:06:44 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-02-07 12:06:44 -0500
commit1ba1922f2a4a40357cdacf22ce3a418819acbf54 (patch)
tree8f6bf2b205c46f1f2682dc137302ffece033eec2 /misc
parentfix used before define on sv/s (diff)
downloadelfix-1ba1922f2a4a40357cdacf22ce3a418819acbf54.tar.gz
elfix-1ba1922f2a4a40357cdacf22ce3a418819acbf54.tar.bz2
elfix-1ba1922f2a4a40357cdacf22ce3a418819acbf54.zip
install.wrapper.c: correctly deal with args taking arguments
We can't rely on getopt_long returning '?' to skip arguments that take a subsequent argument in short form. This can result in a miscalculation of "first". For example, install-xattr -m 0555 foo bar when bar is a directory will fail due to there being no file "0555" without this change. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'misc')
-rw-r--r--misc/install.wrapper.c/install.wrapper.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/misc/install.wrapper.c/install.wrapper.c b/misc/install.wrapper.c/install.wrapper.c
index f0425f9..0f25520 100644
--- a/misc/install.wrapper.c/install.wrapper.c
+++ b/misc/install.wrapper.c/install.wrapper.c
@@ -252,18 +252,31 @@ main(int argc, char* argv[])
static struct option long_options[] = {
{ "directory", no_argument, 0, 'd'},
{ "target-directory", required_argument, 0, 't'},
+ { "group", required_argument, 0, 'g'},
+ { "mode", required_argument, 0, 'm'},
+ { "owner", required_argument, 0, 'o'},
+ { "suffix", required_argument, 0, 'S'},
+ { "context", optional_argument, 0, 'Z'},
+ { "backup", optional_argument, 0, 'b'},
{ "help", no_argument, 0, 0 },
{ 0, 0, 0, 0 }
};
int option_index;
- int c = getopt_long(argc, argv, "dt:", long_options, &option_index);
+ int c = getopt_long(argc, argv, "dt:g:m:o:S:Z:", long_options, &option_index);
+
if (c == -1)
break;
switch (c) {
case 0:
+ case 'g':
+ case 'm':
+ case 'o':
+ case 'S':
+ case 'Z':
+ case 'b':
case '?':
/* We skip the flags we don't care about */
break;