From fe68604f113773c1ffcb6d83d4a2febc3e0e3ed8 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Fri, 16 Oct 2009 10:44:58 -0400 Subject: [PATCH] exit less start cleanup of calls to exit scatter into library code. ugen_ callers handle error returns correctly; rmtsys already deals with errors; and rx_pthread can already deal with errors in the case that's fixed Reviewed-on: http://gerrit.openafs.org/667 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/rx/rx_pthread.c | 3 +-- src/sys/rmtsysc.c | 4 ++-- src/ubik/uinit.c | 10 +++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/rx/rx_pthread.c b/src/rx/rx_pthread.c index 96fd36be5f..394e14e73e 100644 --- a/src/rx/rx_pthread.c +++ b/src/rx/rx_pthread.c @@ -91,8 +91,7 @@ server_entry(void *argp) void (*server_proc) (void *) = (void (*)(void *))argp; server_proc(NULL); dpf(("rx_pthread.c: server_entry: Server proc returned unexpectedly\n")); - exit(1); - return NULL; + return (void *) -1; /* reused as return value, see pthread(3) */ } /* diff --git a/src/sys/rmtsysc.c b/src/sys/rmtsysc.c index 52a1874ce4..87dbd66f53 100644 --- a/src/sys/rmtsysc.c +++ b/src/sys/rmtsysc.c @@ -256,8 +256,8 @@ pioctl(char *path, afs_int32 cmd, struct ViceIoctl *data, afs_int32 follow) /* assuming relative path name */ if (getcwd(pathname, 256) == NULL) { free(inbuffer); - printf("getwd failed; exiting\n"); - exit(1); + printf("getwd failed\n"); + return -1; } strcpy(pathname + strlen(pathname), "/"); strcat(pathname, path); diff --git a/src/ubik/uinit.c b/src/ubik/uinit.c index 22f0131e31..b1e5259c65 100644 --- a/src/ubik/uinit.c +++ b/src/ubik/uinit.c @@ -94,7 +94,7 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s "%s: can't find cell %s's hosts in %s/%s\n", funcName, cellName, AFSDIR_SERVER_ETC_DIRPATH, AFSDIR_CELLSERVDB_FILE); - exit(1); + return -1; } } else { /* not -localauth */ tdir = afsconf_Open(confDir); @@ -111,7 +111,7 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s fprintf(stderr, "%s: can't get local cellname, check %s/%s\n", funcName, confDir, AFSDIR_THISCELL_FILE); - exit(1); + return -1; } cellName = cellstr; } @@ -122,7 +122,7 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s fprintf(stderr, "%s: can't find cell %s's hosts in %s/%s\n", funcName, cellName, confDir, AFSDIR_CELLSERVDB_FILE); - exit(1); + return -1; } if (noAuthFlag) /* -noauth */ scIndex = 0; @@ -159,7 +159,7 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s default: fprintf(stderr, "%s: unsupported security index %d\n", funcName, scIndex); - exit(1); + return -1; break; } } @@ -176,7 +176,7 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s fprintf(stderr, "%s: info.numServers=%d (> maxservers=%d)\n", funcName, info.numServers, maxservers); - exit(1); + return -1; } for (i = 0; i < info.numServers; i++) { serverconns[i] =