[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Using "xl create" without domain config file
W. Michael Petullo writes ("Re: [Xen-devel] Using "xl create" without domain config file"): > [...] > > Another alternative would be to special-case the string "/dev/null" > > (in xl, not libxl) and not read a config file at all in that case. > > This patch treats /dev/null as a special case. Thanks, this is going in the right direction I think. Just two niggles: > diff -r 435493696053 tools/libxl/xl_cmdimpl.c > --- a/tools/libxl/xl_cmdimpl.c Fri May 25 08:18:47 2012 +0100 > +++ b/tools/libxl/xl_cmdimpl.c Thu Jun 07 22:40:58 2012 -0500 > @@ -1454,10 +1454,13 @@ static int create_domain(struct domain_c > > if (config_file) { > free(config_data); config_data = 0; ... > + // /dev/null represents special case (read config. from command line) libxl coding style uses /*...*/ comments. > + if (strcmp(config_file, "/dev/null")) { > + ret = libxl_read_file_contents(&ctx, config_file, > + &config_data, &config_len); I think this fails to set config_len to 0 in the /dev/null case, which it should do. Although config_len is initialised to 0 it may have been set to a non-0 value from the length of the old config file if we're doing a restore, and in this case it needs to be rezeroed. > + if (ret) { fprintf(stderr, "Failed to read config file: %s: > %s\n", > + config_file, strerror(errno)); return > ERROR_FAIL; } > + } > if (!restore_file && extra_config && strlen(extra_config)) { > if (config_len > INT_MAX - (strlen(extra_config) + 2 + 1)) { > fprintf(stderr, "Failed to attach extra configration\n"); thanks, Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |