summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gns/nss/nss_gns_query.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c
index af5c91b72..11e46ad7f 100644
--- a/src/gns/nss/nss_gns_query.c
+++ b/src/gns/nss/nss_gns_query.c
@@ -60,15 +60,16 @@ gns_resolve_name (int af, const char *name, struct userdata *u)
FILE *p;
char line[128];
int ret;
+ int retry = 0;
int out[2];
pid_t pid;
if (0 == getuid ())
return -2; /* GNS via NSS is NEVER for root */
- if (0 != pipe (out))
- return -1;
query_gns:
+ if (0 != pipe (out))
+ return -1;
pid = fork ();
if (-1 == pid)
return -1;
@@ -140,21 +141,23 @@ query_gns:
}
(void) fclose (p);
waitpid (pid, &ret, 0);
-
if (! WIFEXITED (ret))
return -1;
if (4 == WEXITSTATUS (ret))
return -2; /* not for GNS */
if (5 == WEXITSTATUS (ret))
- goto restart_arm; /* timeout -> try restart */
+ {
+ if (1 == retry)
+ return -2; /* no go -> service unavailable */
+ retry = 1;
+ system("gnunet-arm -s");
+ goto query_gns; /* Try again */
+ }
if (3 == WEXITSTATUS (ret))
return -2; /* timeout -> service unavailable */
if ((2 == WEXITSTATUS (ret)) || (1 == WEXITSTATUS (ret)))
return -2; /* launch failure -> service unavailable */
return 0;
-restart_arm:
- system("gnunet-arm -s");
- goto query_gns;
}