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

Re: [libvirt] [PATCH 3/7] Test driver implementation of virStorageVolCreateXMLFrom



Daniel P. Berrange wrote:
> On Mon, May 04, 2009 at 01:42:58PM -0400, Cole Robinson wrote:
>> Signed-off-by: Cole Robinson <crobinso redhat com>
>> ---
>>  src/test.c |   95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 95 insertions(+), 0 deletions(-)
>>
>> +
>> +    if (VIR_ALLOC_N(privvol->target.path,
>> +                    strlen(privpool->def->target.path) +
>> +                    1 + strlen(privvol->name) + 1) < 0) {
>> +        virReportOOMError(pool->conn);
>> +        goto cleanup;
>> +    }
>> +
>> +    strcpy(privvol->target.path, privpool->def->target.path);
>> +    strcat(privvol->target.path, "/");
>> +    strcat(privvol->target.path, privvol->name);
>> +    privvol->key = strdup(privvol->target.path);
>> +    if (privvol->key == NULL) {
>> +        virReportOOMError(pool->conn);
>> +        goto cleanup;
>> +    }
> 
> Be a little shorter to just call virAsprintf() for target.path
> 
> ACK aside from that
> 
> Daniel

That's largely just duplication of code that was already in the storage
driver, so there are other culprits as well. I'll send a cleanup patch
after this series is applied (or before a v2) that fixes all the cases.

Thanks,
Cole


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