summaryrefslogtreecommitdiff
path: root/libstore
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-05-10 21:19:39 +0000
committerMiles Bader <miles@gnu.org>1996-05-10 21:19:39 +0000
commit65ba786e28d41ff4f5081f8d8d1378dac6235de0 (patch)
tree37bd292c4b2a376943df866768a2437bc970e78f /libstore
parent8bbe3bcc862ce11c70287e1197446f9de78c478a (diff)
(store_clone): Clone children too.
Diffstat (limited to 'libstore')
-rw-r--r--libstore/clone.c15
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);