Re: [PATCH v2 05/10] utils: util functions for scsi hostdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/03/2013 05:04 PM, Osier Yang wrote:
On 01/04/13 20:00, Han Cheng wrote:
+ if (virAsprintf(&tmp, SCSI_DEVFS "/%s/vendor", dev->name) < 0) {
+ virReportOOMError();
+ goto out;
+ }
+ if (virFileReadAll(tmp, 1024, &vendor) < 0)
+ goto out;
+ VIR_FREE(tmp);
+ tmp = NULL;
+ if (virAsprintf(&tmp, SCSI_DEVFS "/%s/model", dev->name) < 0) {
+ virReportOOMError();
+ goto out;
+ }
+ if (virFileReadAll(tmp, 1024, &model) < 0)
+ goto out;
+ *(vendor + strlen(vendor) - 1) = '\0';

This should be right after reading "vendor"

+ *(model + strlen(model) - 1) = '\0';
+ if (virAsprintf(&dev->id, "%s %s", vendor, model) < 0) {

Is it possible for the "vendor" and "name" contains white space(s)? if
it is,
then separating them by one space has problem.

Actually, it is due to my tests which are done before sending thest patches out. I thought this may not be a big problem. It seems not. So we need to virTrimSpaces to trim the spaces.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]