diff options
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.28 2008-06-02 21:08:36 nicm Exp $ */ +/* $Id: client.c,v 1.29 2008-06-07 07:27:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -51,11 +51,9 @@ client_init(const char *path, struct client_ctx *cctx, int start_server) retries = 0; retry: if (stat(path, &sb) != 0) { - if (start_server && errno == ENOENT && retries < 10) { - if (pid == 0) - pid = server_start(path); - usleep(10000); - retries++; + if (start_server && errno == ENOENT) { + if (server_start(path) != 0) + goto no_start; goto retry; } goto fail; @@ -81,9 +79,8 @@ retry: if (start_server && errno == ECONNREFUSED && retries < 10) { if (unlink(path) != 0) goto fail; - usleep(10000); - retries++; - goto retry; + if (server_start(path) != 0) + goto no_start; } goto fail; } @@ -112,6 +109,10 @@ retry: return (0); +no_start: + log_warnx("server failed to start"); + return (1); + fail: log_warn("server not found"); return (1); |