[libvirt] syntax-check vs. close [was: [PATCH 1/3] Cancel migration if user presses Ctrl-C when migration is in progress]
Eric Blake
eblake at redhat.com
Thu Jan 27 21:12:59 UTC 2011
On 01/25/2011 12:05 AM, Wen Congyang wrote:
>>> +cleanup:
>>> >> + if (dom)
>>> >> + virDomainFree(dom);
My bad for thinking this was a violation of the useless-if-before-free
rule; virDomainFree is _not_ free-like: it returns an int, and issues an
error if domain is NULL.
>>> >> + if (p[0] != -1) {
>>> >> + close(p[0]);
>>> >> + close(p[1]);
>> >
>> > 'make syntax-check' should have caught these violations (if it didn't,
>> > then that's something that we should fix). This should be:
> unfortunately, 'make syntax-check' does not catch these violations.
Oops. Stupid typo on my part, back in commit f1fe9671. Full patch
coming up, once I fix the remaining violations that the typo fix caught.
Oh, and I should probably add a rule to prohibit popen while I'm at it
(virCommand is better, but I thought of it because pclose is problematic).
diff --git i/cfg.mk w/cfg.mk
index 066fa3d..10eaab2 100644
--- i/cfg.mk
+++ w/cfg.mk
@@ -241,7 +241,7 @@ sc_avoid_write:
# Avoid functions that can lead to double-close bugs.
sc_prohibit_close:
- @prohibit='\<[f]close *\(' \
+ @prohibit='\<[f]?close *\(' \
halt='use VIR_{FORCE_}[F]CLOSE instead of [f]close' \
$(_sc_search_regexp)
@prohibit='\<fdopen *\(' \
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110127/011babfe/attachment-0001.sig>
More information about the libvir-list
mailing list