From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 47222138CA9 for ; Fri, 7 Feb 2014 18:10:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 37E13E0A83; Fri, 7 Feb 2014 18:10:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A1F37E0A83 for ; Fri, 7 Feb 2014 18:10:03 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CCD3933F726 for ; Fri, 7 Feb 2014 18:10:02 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 6463718875 for ; Fri, 7 Feb 2014 18:10:01 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1391792804.1ba1922f2a4a40357cdacf22ce3a418819acbf54.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:master commit in: misc/install.wrapper.c/ X-VCS-Repository: proj/elfix X-VCS-Files: misc/install.wrapper.c/install.wrapper.c X-VCS-Directories: misc/install.wrapper.c/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: 1ba1922f2a4a40357cdacf22ce3a418819acbf54 X-VCS-Branch: master Date: Fri, 7 Feb 2014 18:10:01 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: b7c6f316-00d5-48de-9343-ec3a86523244 X-Archives-Hash: 6ff359f88b0ae94144a1de30a1fa0a10 commit: 1ba1922f2a4a40357cdacf22ce3a418819acbf54 Author: Gregory M. Turner be-evil net> AuthorDate: Fri Feb 7 17:06:44 2014 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Fri Feb 7 17:06:44 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=1ba1922f 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 gentoo.org> --- misc/install.wrapper.c/install.wrapper.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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;