From d4fc72d47e20914abfaf16028fbc000510aae267 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 18 Mar 2005 00:24:27 +0000 Subject: [PATCH] applied changes in the MatchList-API git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1921 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/src/vcopy-init.hc | 34 ++++++++++++++++++++++++++++------ util-vserver/src/vunify-init.hc | 19 +++++++++++++------ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/util-vserver/src/vcopy-init.hc b/util-vserver/src/vcopy-init.hc index 6feaecf..80b7c67 100644 --- a/util-vserver/src/vcopy-init.hc +++ b/util-vserver/src/vcopy-init.hc @@ -69,25 +69,47 @@ static void initModeVserver(int argc, char *argv[]) { int count = argc; - struct MatchVserverInfo const src_vserver = { argv[1], true }; - struct MatchVserverInfo const dst_vserver = { argv[0], false }; - + struct MatchVserverInfo src_vserver = { + .name = argv[1], + .use_pkgmgmt = true + }; + + if (!MatchVserverInfo_init(&src_vserver)) { + WRITE_MSG(2, "Failed to initialize unification for source-vserver\n"); + exit(1); + } if (count!=2) { WRITE_MSG(2, "Bad arguments; try '--help' for more information\n"); exit(1); } - if (!MatchList_initByVserver(&global_info.src_list, &src_vserver, 0)) { + if (!MatchList_initByVserver(&global_info.src_list, &src_vserver)) { WRITE_MSG(2, "unification not configured for source vserver\n"); exit(1); } + MatchVserverInfo_free(&src_vserver); + + + + struct MatchVserverInfo dst_vserver = { + .name = argv[0], + .use_pkgmgmt = false + }; + if (!global_args->is_strict) createSkeleton(dst_vserver.name); - - if (!MatchList_initByVserver(&global_info.dst_list, &dst_vserver, 0)) { + + if (!MatchVserverInfo_init(&dst_vserver)) { + WRITE_MSG(2, "Failed to initialize unification for destination-vserver\n"); + exit(1); + } + + if (!MatchList_initByVserver(&global_info.dst_list, &dst_vserver)) { WRITE_MSG(2, "unification not configured for destination vserver\n"); exit(1); } + + MatchVserverInfo_free(&dst_vserver); } diff --git a/util-vserver/src/vunify-init.hc b/util-vserver/src/vunify-init.hc index fd20662..b1aa7de 100644 --- a/util-vserver/src/vunify-init.hc +++ b/util-vserver/src/vunify-init.hc @@ -47,22 +47,29 @@ initModeManually(struct Arguments const UNUSED *args, int argc, char *argv[]) static void initModeVserver(struct Arguments const UNUSED *args, int argc, char *argv[]) { - char const *appdir; - struct MatchVserverInfo const dst_vserver = { argv[0], true }; + struct MatchVserverInfo vserver = { + .name = argv[0], + .use_pkgmgmt = true + }; + + if (!MatchVserverInfo_init(&vserver)) { + WRITE_MSG(2, "Failed to initialize unification for this vserver\n"); + exit(1); + } if (argc!=1) { WRITE_MSG(2, "More than one vserver is not supported\n"); exit(1); } - if (!MatchList_initByVserver(&global_info.dst_list, &dst_vserver, &appdir)) { + if (!MatchList_initByVserver(&global_info.dst_list, &vserver)) { WRITE_MSG(2, "unification not configured for this vserver\n"); exit(1); } MatchList_initRefserverList(&global_info.src_lists.v, &global_info.src_lists.l, - appdir); - - free(const_cast(char *)(appdir)); + vserver.appdir.d); + + MatchVserverInfo_free(&vserver); } -- 1.8.1.5