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 <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Derrick Brashear 2009-10-16 10:44:58 -04:00 committed by Derrick Brashear
parent 50313a72a9
commit fe68604f11
3 changed files with 8 additions and 9 deletions

View File

@ -91,8 +91,7 @@ server_entry(void *argp)
void (*server_proc) (void *) = (void (*)(void *))argp; void (*server_proc) (void *) = (void (*)(void *))argp;
server_proc(NULL); server_proc(NULL);
dpf(("rx_pthread.c: server_entry: Server proc returned unexpectedly\n")); dpf(("rx_pthread.c: server_entry: Server proc returned unexpectedly\n"));
exit(1); return (void *) -1; /* reused as return value, see pthread(3) */
return NULL;
} }
/* /*

View File

@ -256,8 +256,8 @@ pioctl(char *path, afs_int32 cmd, struct ViceIoctl *data, afs_int32 follow)
/* assuming relative path name */ /* assuming relative path name */
if (getcwd(pathname, 256) == NULL) { if (getcwd(pathname, 256) == NULL) {
free(inbuffer); free(inbuffer);
printf("getwd failed; exiting\n"); printf("getwd failed\n");
exit(1); return -1;
} }
strcpy(pathname + strlen(pathname), "/"); strcpy(pathname + strlen(pathname), "/");
strcat(pathname, path); strcat(pathname, path);

View File

@ -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", "%s: can't find cell %s's hosts in %s/%s\n",
funcName, cellName, AFSDIR_SERVER_ETC_DIRPATH, funcName, cellName, AFSDIR_SERVER_ETC_DIRPATH,
AFSDIR_CELLSERVDB_FILE); AFSDIR_CELLSERVDB_FILE);
exit(1); return -1;
} }
} else { /* not -localauth */ } else { /* not -localauth */
tdir = afsconf_Open(confDir); tdir = afsconf_Open(confDir);
@ -111,7 +111,7 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s
fprintf(stderr, fprintf(stderr,
"%s: can't get local cellname, check %s/%s\n", "%s: can't get local cellname, check %s/%s\n",
funcName, confDir, AFSDIR_THISCELL_FILE); funcName, confDir, AFSDIR_THISCELL_FILE);
exit(1); return -1;
} }
cellName = cellstr; cellName = cellstr;
} }
@ -122,7 +122,7 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s
fprintf(stderr, fprintf(stderr,
"%s: can't find cell %s's hosts in %s/%s\n", "%s: can't find cell %s's hosts in %s/%s\n",
funcName, cellName, confDir, AFSDIR_CELLSERVDB_FILE); funcName, cellName, confDir, AFSDIR_CELLSERVDB_FILE);
exit(1); return -1;
} }
if (noAuthFlag) /* -noauth */ if (noAuthFlag) /* -noauth */
scIndex = 0; scIndex = 0;
@ -159,7 +159,7 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s
default: default:
fprintf(stderr, "%s: unsupported security index %d\n", fprintf(stderr, "%s: unsupported security index %d\n",
funcName, scIndex); funcName, scIndex);
exit(1); return -1;
break; break;
} }
} }
@ -176,7 +176,7 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s
fprintf(stderr, fprintf(stderr,
"%s: info.numServers=%d (> maxservers=%d)\n", "%s: info.numServers=%d (> maxservers=%d)\n",
funcName, info.numServers, maxservers); funcName, info.numServers, maxservers);
exit(1); return -1;
} }
for (i = 0; i < info.numServers; i++) { for (i = 0; i < info.numServers; i++) {
serverconns[i] = serverconns[i] =