netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Synacek <jsynacek@redhat.com>
To: yoshfuji@linux-ipv6.org
Cc: netdev@vger.kernel.org, Jan Synacek <jsynacek@redhat.com>
Subject: [PATCH 2/2] arping: Call usage() before limiting capabilities.
Date: Tue, 27 Nov 2012 13:19:35 +0100	[thread overview]
Message-ID: <1354018775-4966-2-git-send-email-jsynacek@redhat.com> (raw)
In-Reply-To: <1354018775-4966-1-git-send-email-jsynacek@redhat.com>

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

  reply	other threads:[~2012-11-27 12:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 12:19 [PATCH 1/2] arping: Fix finding of a default interface when no -I is specified Jan Synacek
2012-11-27 12:19 ` Jan Synacek [this message]
2012-11-28 18:18   ` [PATCH 2/2] arping: Call usage() before limiting capabilities YOSHIFUJI Hideaki
2012-11-28 18:38 ` [PATCH 1/2] arping: Fix finding of a default interface when no -I is specified YOSHIFUJI Hideaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354018775-4966-2-git-send-email-jsynacek@redhat.com \
    --to=jsynacek@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).