Call usage() before limiting capabilities

This commit is contained in:
Jan Synacek 2012-11-27 13:27:30 +01:00
parent 2a9bd4b102
commit 1f3c921558
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,60 @@
From 8e892529af268a4e86bae045e07c93b5d4c360b0 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Tue, 27 Nov 2012 12:53:23 +0100
Subject: [PATCH 2/2] arping: Call usage() before limiting capabilities.
Otherwise, running arping binary without the capabilities set results in printing
warnings with the usage.
Signed-off-by: Jan Synacek <jsynacek@redhat.com>
---
arping.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/arping.c b/arping.c
index ccb68a0..02e3d9c 100644
--- a/arping.c
+++ b/arping.c
@@ -959,19 +959,6 @@ main(int argc, char **argv)
int socket_errno;
int ch;
- limit_capabilities();
-
-#ifdef USE_IDN
- setlocale(LC_ALL, "");
-#endif
-
- enable_capability_raw();
-
- s = socket(PF_PACKET, SOCK_DGRAM, 0);
- socket_errno = errno;
-
- disable_capability_raw();
-
while ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:V")) != EOF) {
switch(ch) {
case 'b':
@@ -1023,6 +1010,19 @@ main(int argc, char **argv)
target = *argv;
+ limit_capabilities();
+
+#ifdef USE_IDN
+ setlocale(LC_ALL, "");
+#endif
+
+ enable_capability_raw();
+
+ s = socket(PF_PACKET, SOCK_DGRAM, 0);
+ socket_errno = errno;
+
+ disable_capability_raw();
+
if (device.name && !*device.name)
device.name = NULL;
--
1.7.11.7

View File

@ -20,6 +20,7 @@ Patch3: iputils-ifenslave.patch
Patch4: iputils-20121112-idn.patch Patch4: iputils-20121112-idn.patch
Patch5: iputils-20071127-corr_type.patch Patch5: iputils-20071127-corr_type.patch
Patch7: iputils-20121121-ifaddrs.patch Patch7: iputils-20121121-ifaddrs.patch
Patch8: iputils-20121125-usage-before-caps.patch
BuildRequires: docbook-utils perl-SGMLSpm BuildRequires: docbook-utils perl-SGMLSpm
BuildRequires: glibc-kernheaders >= 2.4-8.19 BuildRequires: glibc-kernheaders >= 2.4-8.19
@ -63,6 +64,7 @@ The iputils-sysvinit contains SysV initscritps support.
%patch4 -p1 -b .idn %patch4 -p1 -b .idn
%patch5 -p1 -b .corr_type %patch5 -p1 -b .corr_type
%patch7 -p1 -b .ifaddrs %patch7 -p1 -b .ifaddrs
%patch8 -p1 -b .usage-before-caps
%build %build
%ifarch s390 s390x %ifarch s390 s390x
@ -148,6 +150,7 @@ mv -f RELNOTES.tmp RELNOTES
* Mon Nov 26 2012 Jan Synáček <jsynacek@redhat.com> - 20121125-2 * Mon Nov 26 2012 Jan Synáček <jsynacek@redhat.com> - 20121125-2
- Comment patches and cleanup - Comment patches and cleanup
- Update ifaddrs patch - Update ifaddrs patch
- Call usage() before limiting capabilities
* Mon Nov 26 2012 Jan Synáček <jsynacek@redhat.com> - 20121125-1 * Mon Nov 26 2012 Jan Synáček <jsynacek@redhat.com> - 20121125-1
- Update to iputils-s20121125 (#879952) - Update to iputils-s20121125 (#879952)