
"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Mon, Feb 02, 2009 at 06:08:20PM +0100, Jim Meyering wrote:
From: Jim Meyering <meyering@redhat.com>
Thanks for the review.
- err_delbr1: + err_delbr1:; + char ebuf[1024];
A stray ';' crept in there.
Actually, it's required by C. The ";" adds an empty statement before the new declaration, to serve as a target for the label.
diff --git a/src/storage_driver.c b/src/storage_driver.c index a456061..d644b63 100644 --- a/src/storage_driver.c +++ b/src/storage_driver.c @@ -1,7 +1,7 @@ /* * storage_driver.c: core driver for storage APIs * - * Copyright (C) 2006-2008 Red Hat, Inc. + * Copyright (C) 2006-2009 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -567,9 +567,10 @@ storagePoolUndefine(virStoragePoolPtr obj) { if (virStoragePoolObjDeleteDef(obj->conn, pool) < 0) goto cleanup;
+ char ebuf[1024]; if (unlink(pool->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) storageLog("Failed to delete autostart link '%s': %s", - pool->autostartLink, strerror(errno)); + pool->autostartLink, virStrerror(errno, ebuf, sizeof ebuf));
The variable decl should be inside the if () {} clause there.
Oops. No idea why I did that. Fixed.
@@ -788,29 +789,30 @@ static int umlStartVMDaemon(virConnectPtr conn, return -1; }
+ char ebuf[1024]; tmp = progenv; while (*tmp) {
Here, the var decl should be inside the while() loop too
Well, if I move the decl into that first while loop, then I'd have to add 3 more, one into the next while loop, and then two more, each into currently-single-stmt if-blocks. Seems slightly better to add just that one decl than to add 4.
@@ -99,10 +100,12 @@ virUUIDGenerate(unsigned char *uuid) if (uuid == NULL) return(-1);
+ char ebuf[1024]; if ((err = virUUIDGenerateRandomBytes(uuid, VIR_UUID_BUFLEN))) qemudLog(QEMUD_WARN, _("Falling back to pseudorandom UUID," - " failed to generate random bytes: %s"), strerror(err)); + " failed to generate random bytes: %s"), + virStrerror(err, ebuf, sizeof ebuf));
return virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN);
AGain the ebuf needs to move inside the block
Good catch. Done.