diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-03-25 18:49:14 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-03-25 18:49:14 +0000 |
commit | 9e2a53e13e0b90e45dea6189b0e5363bd19c90e6 (patch) | |
tree | c495986947820cf85fcbb00b7247f15917ad3912 /lib/libc/rpc | |
parent | cd2d5e9f2262e73b4408500072eddd11d546ceb8 (diff) |
eliminate call to abort(), which is very bad in libs. I forgat how
this diff came into my tree, apologies for not naming the contributor.
ok tedu@ deraadt@
Diffstat (limited to 'lib/libc/rpc')
-rw-r--r-- | lib/libc/rpc/auth_unix.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/libc/rpc/auth_unix.c b/lib/libc/rpc/auth_unix.c index 8d8080d5b77..432b6a1ca7f 100644 --- a/lib/libc/rpc/auth_unix.c +++ b/lib/libc/rpc/auth_unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth_unix.c,v 1.20 2006/11/10 17:29:31 grunk Exp $ */ +/* $OpenBSD: auth_unix.c,v 1.21 2007/03/25 18:49:13 otto Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -136,7 +136,7 @@ authunix_create(char *machname, int uid, int gid, int len, int *aup_gids) */ xdrmem_create(&xdrs, mymem, MAX_AUTH_BYTES, XDR_ENCODE); if (!xdr_authunix_parms(&xdrs, &aup)) - abort(); /* XXX abort illegal in library */ + goto authfail; au->au_origcred.oa_length = len = XDR_GETPOS(&xdrs); au->au_origcred.oa_flavor = AUTH_UNIX; #ifdef KERNEL @@ -144,10 +144,7 @@ authunix_create(char *machname, int uid, int gid, int len, int *aup_gids) #else if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) { (void)fprintf(stderr, "authunix_create: out of memory\n"); - XDR_DESTROY(&xdrs); - free(au); - free(auth); - return (NULL); + goto authfail; } #endif memcpy(au->au_origcred.oa_base, mymem, (u_int)len); @@ -158,6 +155,12 @@ authunix_create(char *machname, int uid, int gid, int len, int *aup_gids) auth->ah_cred = au->au_origcred; marshal_new_auth(auth); return (auth); + +authfail: + XDR_DESTROY(&xdrs); + free(au); + free(auth); + return (NULL); } |