X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib_internal%2Fmatchlist-initmanually.c;h=8f29abbfba57721e96436528ede118a3fbbfb327;hb=8c87138af9755c6125ae79bb4c1890e6a33dc1a2;hp=02aecd376b4db04be4bdb3aa2d4001e28cb3a01b;hpb=2fb6b6da0754ba35f18352e224d6239d437f8906;p=util-vserver.git diff --git a/util-vserver/lib_internal/matchlist-initmanually.c b/util-vserver/lib_internal/matchlist-initmanually.c index 02aecd3..8f29abb 100644 --- a/util-vserver/lib_internal/matchlist-initmanually.c +++ b/util-vserver/lib_internal/matchlist-initmanually.c @@ -146,7 +146,8 @@ getConfigfileList(char const *vserver, } void -MatchList_initManually(struct MatchList *list, char const *vserver, +MatchList_initManually(struct MatchList *list, + struct MatchVserverInfo const *vserver, char const *vdir, char const *exclude_file) { char *buf[2] = { 0,0 }; @@ -156,21 +157,31 @@ MatchList_initManually(struct MatchList *list, char const *vserver, char **expr_files = 0; size_t expr_count = 0; + size_t len; + assert((vdir==0 && vserver!=0) || (vdir!=0 && vserver==0)); + + if (vserver) { + vdir = vserver->vdir.d; + len = vserver->vdir.l; + } + else + len = strlen(vdir); + if (Global_getVerbosity()>=1) { WRITE_MSG(1, "Initializing exclude-list for "); - WRITE_STR(1, vdir); + (void)write(1, vdir, len); if (vserver!=0) { WRITE_MSG(1, " ("); - WRITE_STR(1, vserver); + WRITE_STR(1, vserver->name); WRITE_MSG(1, ")"); } WRITE_MSG(1, "\n"); } - if (vserver && Global_doRenew()) { + if (vserver && vserver->use_pkgmgmt && Global_doRenew()) { if (Global_getVerbosity()>=2) WRITE_MSG(1, " Fetching configuration-file list from packagemanagement\n"); - getConfigfileList(vserver, &fixed_files, &fixed_count, buf+0); + getConfigfileList(vserver->name, &fixed_files, &fixed_count, buf+0); } // abuse special values (NULL, empty string) to skip the next step @@ -181,11 +192,11 @@ MatchList_initManually(struct MatchList *list, char const *vserver, buf+1); } - MatchList_init(list, vdir, fixed_count + expr_count); + MatchList_init(list, strdup(vdir), fixed_count + expr_count); list->buf = Emalloc(sizeof(void *) * 3); list->buf[0] = buf[0]; list->buf[1] = buf[1]; - list->buf[2] = vdir; + list->buf[2] = list->root.d; list->buf_count = 3; MatchList_appendFiles(list, 0, fixed_files, fixed_count, false);