gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: use more proper way to pars


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: use more proper way to parse cli options
Date: Mon, 25 Jun 2018 13:44:15 +0200

This is an automated email from the git hooks/post-receive script.

julius-buenger pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 64e37887e use more proper way to parse cli options
64e37887e is described below

commit 64e37887ea50a99b2ff4a3991d75dab9ea2a0c49
Author: Julius Bünger <address@hidden>
AuthorDate: Mon Jun 25 13:43:16 2018 +0200

    use more proper way to parse cli options
---
 src/rps/gnunet-rps.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/rps/gnunet-rps.c b/src/rps/gnunet-rps.c
index e09277589..739f71dac 100644
--- a/src/rps/gnunet-rps.c
+++ b/src/rps/gnunet-rps.c
@@ -155,7 +155,11 @@ run (void *cls,
       (!view_update))
   { /* Request n PeerIDs */
     /* If number was specified use it, else request single peer. */
-    num_peers = (NULL == args[0]) ? 1 : atoi (args[0]);
+    if (NULL == args[0] ||
+        0 == sscanf (args[0], "%lu", &num_peers))
+    {
+      num_peers = 1;
+    }
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
         "Requesting %" PRIu64 " PeerIDs\n", num_peers);
     req_handle = GNUNET_RPS_request_peers (rps_handle, num_peers, 
reply_handle, NULL);
@@ -163,7 +167,11 @@ run (void *cls,
   } else if (view_update)
   {
     /* Get updates of view */
-    num_view_updates = (NULL == args[0]) ? 0 : atoi (args[0]);
+    if (NULL == args[0] ||
+        0 == sscanf (args[0], "%lu", &num_view_updates))
+    {
+      num_view_updates = 0;
+    }
     GNUNET_RPS_view_request (rps_handle, num_view_updates, view_update_handle, 
NULL);
     if (0 != num_view_updates)
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]