summaryrefslogtreecommitdiff
path: root/libiohelp/iouser-dup.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-06-16 20:22:14 +0000
committerRoland McGrath <roland@gnu.org>2001-06-16 20:22:14 +0000
commita2529808d1aaf878eb6fff54ab491bd3d47db894 (patch)
tree426a3711fbb7be96251412ca626976c1246439a8 /libiohelp/iouser-dup.c
parent93054f14cb52bfd576e4ecfdcf0bc1c468e4cbbf (diff)
2001-04-21 Neal H Walfield <neal@cs.uml.edu>
* 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.
Diffstat (limited to 'libiohelp/iouser-dup.c')
-rw-r--r--libiohelp/iouser-dup.c21
1 files changed, 13 insertions, 8 deletions
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;
}