[libvirt] [PATCH] Remove two unused PATH_MAX-sized char arrays from the stack
Matthias Bolte
matthias.bolte at googlemail.com
Tue Jan 18 22:28:18 UTC 2011
2011/1/17 Daniel P. Berrange <berrange at redhat.com>:
> On Sun, Jan 16, 2011 at 12:05:32AM +0100, Matthias Bolte wrote:
>> ---
>> src/storage/storage_driver.c | 16 ++--------------
>> src/uml/uml_driver.c | 8 ++------
>> 2 files changed, 4 insertions(+), 20 deletions(-)
>>
>> diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
>> index 67d043b..5373025 100644
>> --- a/src/storage/storage_driver.c
>> +++ b/src/storage/storage_driver.c
>> @@ -127,9 +127,9 @@ storageDriverAutostart(virStorageDriverStatePtr driver) {
>> * Initialization function for the QEmu daemon
>> */
>> static int
>> -storageDriverStartup(int privileged) {
>> +storageDriverStartup(int privileged)
>> +{
>> char *base = NULL;
>> - char driverConf[PATH_MAX];
>>
>> if (VIR_ALLOC(driverState) < 0)
>> return -1;
>> @@ -160,11 +160,6 @@ storageDriverStartup(int privileged) {
>> /* Configuration paths are either ~/.libvirt/storage/... (session) or
>> * /etc/libvirt/storage/... (system).
>> */
>> - if (snprintf (driverConf, sizeof(driverConf),
>> - "%s/storage.conf", base) == -1)
>> - goto out_of_memory;
>> - driverConf[sizeof(driverConf)-1] = '\0';
>> -
>> if (virAsprintf(&driverState->configDir,
>> "%s/storage", base) == -1)
>> goto out_of_memory;
>> @@ -175,13 +170,6 @@ storageDriverStartup(int privileged) {
>>
>> VIR_FREE(base);
>>
>> - /*
>> - if (virStorageLoadDriverConfig(driver, driverConf) < 0) {
>> - virStorageDriverShutdown();
>> - return -1;
>> - }
>> - */
>> -
>> if (virStoragePoolLoadAllConfigs(&driverState->pools,
>> driverState->configDir,
>> driverState->autostartDir) < 0)
>> diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
>> index 57f50f6..ef2a5b6 100644
>> --- a/src/uml/uml_driver.c
>> +++ b/src/uml/uml_driver.c
>> @@ -342,10 +342,10 @@ cleanup:
>> * Initialization function for the Uml daemon
>> */
>> static int
>> -umlStartup(int privileged) {
>> +umlStartup(int privileged)
>> +{
>> uid_t uid = geteuid();
>> char *base = NULL;
>> - char driverConf[PATH_MAX];
>> char *userdir = NULL;
>>
>> if (VIR_ALLOC(uml_driver) < 0)
>> @@ -398,10 +398,6 @@ umlStartup(int privileged) {
>> /* Configuration paths are either ~/.libvirt/uml/... (session) or
>> * /etc/libvirt/uml/... (system).
>> */
>> - if (snprintf (driverConf, sizeof(driverConf), "%s/uml.conf", base) == -1)
>> - goto out_of_memory;
>> - driverConf[sizeof(driverConf)-1] = '\0';
>> -
>> if (virAsprintf(¨_driver->configDir, "%s/uml", base) == -1)
>> goto out_of_memory;
>
> ACK
>
> Daniel
>
Thanks, I've pushed the 8 ACKed patches.
Matthias
More information about the libvir-list
mailing list