On 03/17/2010 10:49 AM, Laine Stump wrote:
>> + if (ret == -1) {
>> + virReportSystemError(ret,
>> + _("Failed to truncate volume with "
>> + "path '%s' to %ju bytes:
'%s'\n"),
>> + vol->target.path, (intmax_t)size,
>> + virStrerror(errno, errbuf,
>> sizeof(errbuf)));
+ ret = ftruncate(fd, size);
Likewise, this should be:
virReportSystemError(errno,
_("Failed to truncate volume with "
"path '%s' to %ju bytes),
vol->target.path, (intmax_t)size);
virStrerror(errno, errbuf, sizeof(errbuf)));
Oops - that last line is (probably obviously) an artifact of cut-paste
that I meant to delete.
>> + fd = open(def->target.path, O_RDWR);
>> + if (fd == -1) {
>> + VIR_ERROR("Failed to open storage volume with path '%s':
>> '%s'",
>> + def->target.path,
>> + virStrerror(errno, errbuf, sizeof(errbuf)));
+
Not sure why you're using VIR_ERROR() + manually adding virStrerror()
- isn't this the same thing as virReportSystemError?
I had meant to mention that I've seen this in at least one other place
as well. Is there any reason for using VIR_ERROR like this, or is it
just a historical artifact?