On Mon, Nov 03, 2008 at 12:38:49PM +0100, Chris Lalancette wrote: > Daniel P. Berrange wrote: > > Oops, of course. I've fixed this up and committed the result; the final patch > is attached. > > Thanks for the review, > > -- > Chris Lalancette > Index: src/storage_backend.c > =================================================================== > RCS file: /data/cvs/libvirt/src/storage_backend.c,v > retrieving revision 1.24 > diff -u -r1.24 storage_backend.c > --- src/storage_backend.c 28 Oct 2008 17:48:06 -0000 1.24 > +++ src/storage_backend.c 3 Nov 2008 11:32:15 -0000 > @@ -357,16 +357,17 @@ > char * > virStorageBackendStablePath(virConnectPtr conn, > virStoragePoolObjPtr pool, > - char *devpath) > + const char *devpath) > { > DIR *dh; > struct dirent *dent; > + char *stablepath; > > /* Short circuit if pool has no target, or if its /dev */ > if (pool->def->target.path == NULL || > STREQ(pool->def->target.path, "/dev") || > STREQ(pool->def->target.path, "/dev/")) > - return devpath; > + goto ret_strdup; > > /* The pool is pointing somewhere like /dev/disk/by-path > * or /dev/disk/by-id, so we need to check all symlinks in > @@ -382,7 +383,6 @@ > } > > while ((dent = readdir(dh)) != NULL) { > - char *stablepath; > if (dent->d_name[0] == '.') > continue; > > @@ -407,10 +407,17 @@ > > closedir(dh); > > + ret_strdup: > /* Couldn't find any matching stable link so give back > * the original non-stable dev path > */ > - return devpath; > + > + stablepath = strdup(devpath); > + > + if (stablepath == NULL) > + virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("dup path")); Don't bother with passing a message with any VIR_ERR_NO_MEMORY errors - just use NULL. The message is totally ignored for this error code, and 'dup path' is useless info for the end user anyway Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list