On Wed, Nov 03, 2010 at 11:48:50AM +0000, Daniel P. Berrange wrote: > On Tue, Nov 02, 2010 at 05:36:46PM +0100, Daniel Veillard wrote: > > +virSysinfoDefPtr > > +virSysinfoRead(void) { > > + char *path, *cur, *eol, *base; > > + int pid, outfd = -1, errfd = -1; > > + virSysinfoDefPtr ret = NULL; > > + const char **argv; > > + int n, res, waitret, exitstatus; > > + char *outbuf = NULL; > > + char *errbuf = NULL; > > + > > + path = virFindFileInPath(SYSINFO_SMBIOS_DECODER); > > + if (path == NULL) { > > + virSmbiosReportError(VIR_ERR_INTERNAL_ERROR, > > + _("Failed to find path for %s binary"), > > + SYSINFO_SMBIOS_DECODER); > > + return(NULL); > > + } > > + > > + n = 1 + /* dmidecode */ > > + 1 + /* -q */ > > + 2; /* -t 0,1 */ > > + > > + if (VIR_ALLOC_N(argv, n + 1) < 0) > > + return(NULL); > > + > > + n = 0; > > + argv[n++] = path; > > + argv[n++] = "-q"; > > + argv[n++] = "-t"; > > + argv[n++] = "0,1"; > > + argv[n] = NULL; > > Since there's no conditionally included args here, it is simpler > to avoid the counting of args & alloc & just pre-declare argv > > const char *argv[] = { path, "-q", "-t", "0,1", NULL }; Right, I initially made 2 invokations of dmidecode, and then discovered that -t could take 0,1 ... that's a leftover ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list