diff options
author | Miles Bader <miles@gnu.org> | 1996-05-10 21:19:39 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-05-10 21:19:39 +0000 |
commit | 65ba786e28d41ff4f5081f8d8d1378dac6235de0 (patch) | |
tree | 37bd292c4b2a376943df866768a2437bc970e78f /libstore | |
parent | 8bbe3bcc862ce11c70287e1197446f9de78c478a (diff) |
(store_clone): Clone children too.
Diffstat (limited to 'libstore')
-rw-r--r-- | libstore/clone.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libstore/clone.c b/libstore/clone.c index 3030bae3..56749647 100644 --- a/libstore/clone.c +++ b/libstore/clone.c @@ -60,6 +60,21 @@ store_clone (struct store *from, struct store **to) if (! err) c->source = from->source; } + if (!err && from->num_children > 0) + { + int k; + + c->children = malloc (from->num_children * sizeof (struct store *)); + if (! c->children) + err = ENOMEM; + + for (k = 0; !err && k < from->num_children; k++) + { + err = store_clone (from->children[k], &c->children[k]); + if (! err) + c->num_children++; + } + } if (!err && from->meths->clone) err = (*from->meths->clone)(from, c); |