All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] iputils: ninfod minor changes
@ 2013-01-23 13:37 Jan Synacek
  2013-01-23 13:37 ` [PATCH 1/2] ninfod: Call limit/drop_capabilities() and open_sock() after checking for -h or -v Jan Synacek
  2013-01-23 13:37 ` [PATCH 2/2] ninfod: Make -v exit correctly Jan Synacek
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Synacek @ 2013-01-23 13:37 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev, Jan Synacek

Functions limiting capabilities as well as opening a socket could have been
called needlessly if ninfod was invoked with -h.

Also, ninfod incorrectly kept running if invoked with -v.

Jan Synacek (2):
  ninfod: Call limit/drop_capabilities() and open_sock() after checking
    for -h or -v.
  ninfod: Make -v exit correctly.

 ninfod/ninfod.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

-- 
1.8.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] ninfod: Call limit/drop_capabilities() and open_sock() after checking for -h or -v.
  2013-01-23 13:37 [PATCH 0/2] iputils: ninfod minor changes Jan Synacek
@ 2013-01-23 13:37 ` Jan Synacek
  2013-01-23 13:37 ` [PATCH 2/2] ninfod: Make -v exit correctly Jan Synacek
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Synacek @ 2013-01-23 13:37 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev, Jan Synacek

Signed-off-by: Jan Synacek <jsynacek@redhat.com>
---
 ninfod/ninfod.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ninfod/ninfod.c b/ninfod/ninfod.c
index d1b99d9..58b15aa 100644
--- a/ninfod/ninfod.c
+++ b/ninfod/ninfod.c
@@ -637,16 +637,8 @@ int main (int argc, char **argv)
 
 	appname = argv[0];
 
-	limit_capabilities();
-
-	sock = open_sock();
-	if (sock < 0)
-		sock_errno = errno;
-
 	parse_args(argc, argv);
 
-	drop_capabilities();
-
 	if (opt_h || opt_v)
 		print_copying();
 	if (opt_h) {
@@ -654,6 +646,14 @@ int main (int argc, char **argv)
 		exit(1);
 	}
 
+	limit_capabilities();
+
+	sock = open_sock();
+	if (sock < 0)
+		sock_errno = errno;
+
+	drop_capabilities();
+
 	if (sock_errno) {
 		DEBUG(LOG_ERR, "socket: %s\n", strerror(sock_errno));
 		exit(1);
-- 
1.8.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ninfod: Make -v exit correctly.
  2013-01-23 13:37 [PATCH 0/2] iputils: ninfod minor changes Jan Synacek
  2013-01-23 13:37 ` [PATCH 1/2] ninfod: Call limit/drop_capabilities() and open_sock() after checking for -h or -v Jan Synacek
@ 2013-01-23 13:37 ` Jan Synacek
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Synacek @ 2013-01-23 13:37 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev, Jan Synacek

Signed-off-by: Jan Synacek <jsynacek@redhat.com>
---
 ninfod/ninfod.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ninfod/ninfod.c b/ninfod/ninfod.c
index 58b15aa..52cf446 100644
--- a/ninfod/ninfod.c
+++ b/ninfod/ninfod.c
@@ -639,12 +639,15 @@ int main (int argc, char **argv)
 
 	parse_args(argc, argv);
 
-	if (opt_h || opt_v)
-		print_copying();
 	if (opt_h) {
+		print_copying();
 		print_usage();
 		exit(1);
 	}
+	if (opt_v) {
+		print_copying();
+		return 0;
+	}
 
 	limit_capabilities();
 
-- 
1.8.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-23 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 13:37 [PATCH 0/2] iputils: ninfod minor changes Jan Synacek
2013-01-23 13:37 ` [PATCH 1/2] ninfod: Call limit/drop_capabilities() and open_sock() after checking for -h or -v Jan Synacek
2013-01-23 13:37 ` [PATCH 2/2] ninfod: Make -v exit correctly Jan Synacek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.