gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: fix #5782


From: gnunet
Subject: [gnunet] branch master updated: fix #5782
Date: Sun, 10 May 2020 00:29:44 +0200

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 44bdb66b4 fix #5782
44bdb66b4 is described below

commit 44bdb66b46a0b497831eaa395dd6567da9e80acb
Author: Martin Schanzenbach <address@hidden>
AuthorDate: Sun May 10 00:23:54 2020 +0200

    fix #5782
---
 src/gns/gnunet-gns.c        |  2 +-
 src/gns/nss/nss_gns_query.c | 46 +++++----------------------------------------
 2 files changed, 6 insertions(+), 42 deletions(-)

diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c
index eb1d4f23f..5cf496808 100644
--- a/src/gns/gnunet-gns.c
+++ b/src/gns/gnunet-gns.c
@@ -279,7 +279,7 @@ run (void *cls,
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 _ ("Cannot resolve using GNS: GNUnet peer not running\n"));
-    global_ret = 2;
+    global_ret = 5;
     return;
   }
   to_task = GNUNET_SCHEDULER_add_delayed (timeout,
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c
index 7f6bef90d..af5c91b72 100644
--- a/src/gns/nss/nss_gns_query.c
+++ b/src/gns/nss/nss_gns_query.c
@@ -61,7 +61,6 @@ gns_resolve_name (int af, const char *name, struct userdata 
*u)
   char line[128];
   int ret;
   int out[2];
-  int tried_arm_start = 0;
   pid_t pid;
 
   if (0 == getuid ())
@@ -146,51 +145,16 @@ query_gns:
     return -1;
   if (4 == WEXITSTATUS (ret))
     return -2; /* not for GNS */
-  if ((3 == ret) &&
-      (1 != tried_arm_start))
-    return -3; /* timeout -> try restart */
-  if ((3 == ret) &&
-      (1 == tried_arm_start))
+  if (5 == WEXITSTATUS (ret))
+    goto restart_arm; /* timeout -> try restart */
+  if (3 == WEXITSTATUS (ret))
     return -2; /* timeout -> service unavailable */
   if ((2 == WEXITSTATUS (ret)) || (1 == WEXITSTATUS (ret)))
     return -2; /* launch failure -> service unavailable */
   return 0;
-
-  pid = fork ();
-  if (-1 == pid)
-    return -1;
-  if (0 == pid)
-  {
-    char *argv[] = { "gnunet-arm",
-                     "-s", /* Raw output for easier parsing */
-                     NULL };
-
-    (void) close (STDOUT_FILENO);
-    if ((0 != close (out[0])) ||
-        (STDOUT_FILENO != dup2 (out[1], STDOUT_FILENO)))
-      _exit (1);
-    (void) execvp ("gnunet-arm", argv);
-    _exit (1);
-  }
-  (void) close (out[1]);
-  p = fdopen (out[0], "r");
-  if (NULL == p)
-  {
-    kwait (pid);
-    return -1;
-  }
-  while (NULL != fgets (line, sizeof(line), p))
-  {
-    /**
-     * Read output
-     */
-  }
-  (void) fclose (p);
-  waitpid (pid, &ret, 0);
-  tried_arm_start = 1;
+restart_arm:
+  system("gnunet-arm -s");
   goto query_gns;
-
-
 }
 
 

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



reply via email to

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