From a2529808d1aaf878eb6fff54ab491bd3d47db894 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 16 Jun 2001 20:22:14 +0000 Subject: 2001-04-21 Neal H Walfield * iohelp.h (iohelp_create_iouser): Change declaration such that as error_t is now returned and the iouser is a parameter. (iohelp_create_empty_iouser): New funtion. (iohelp_create_simple_iouser): New function. (iohelp_create_complex_iouser): New funtion. * iouser-create.c (iohelp_create_iouser): Implement new semantics. (iohelp_create_empty_iouser): Implement new function. (iohelp_create_simple_iouser): Implement new function. (iohelp_create_complex_iouser): Implement new function. * iouser-dup.c (iohelp_dup_iouser): Implement new semantics. * iouser-reauth.c (iohelp_reauth): Implement new semantics. --- libiohelp/iouser-dup.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'libiohelp/iouser-dup.c') diff --git a/libiohelp/iouser-dup.c b/libiohelp/iouser-dup.c index 7bc1f87f..9158d0c4 100644 --- a/libiohelp/iouser-dup.c +++ b/libiohelp/iouser-dup.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1996 Free Software Foundation + Copyright (C) 1996,2001 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -17,21 +17,24 @@ #include "iohelp.h" -struct iouser * -iohelp_dup_iouser (struct iouser *iouser) +error_t +iohelp_dup_iouser (struct iouser **clone, struct iouser *iouser) { struct iouser *new; error_t err = 0; - new = malloc (sizeof (struct iouser)); + *clone = new = malloc (sizeof (struct iouser)); if (!new) - return 0; + return ENOMEM; new->uids = make_idvec (); new->gids = make_idvec (); new->hook = 0; if (!new->uids || !new->gids) - goto lose; + { + err = ENOMEM; + goto lose; + } err = idvec_set (new->uids, iouser->uids); if (!err) @@ -45,7 +48,9 @@ iohelp_dup_iouser (struct iouser *iouser) if (new->gids) idvec_free (new->gids); free (new); - return 0; + *clone = 0; + return err; } - return new; + + return 0; } -- cgit v1.2.3