summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-02-22 15:55:04 +0000
committerJim Meyering <meyering@redhat.com>2008-02-22 15:55:04 +0000
commitb59d9c85f1bea94a748fd296e559d806e09193b5 (patch)
tree9402cdf60c7f82a04c3fe9b74eb459947285c2e1 /.x-sc_avoid_write
parentMove safewrite and saferead to a separate file. (diff)
downloadlibvirt-b59d9c85f1bea94a748fd296e559d806e09193b5.tar.gz
libvirt-b59d9c85f1bea94a748fd296e559d806e09193b5.tar.bz2
libvirt-b59d9c85f1bea94a748fd296e559d806e09193b5.zip
Use safewrite in place of write, in many cases.
Also add "make syntax-check" rules to ensure no new uses sneak in. There are many uses of write like this: if (write (fd, xml, towrite) != towrite) return -1; The problem is that the syscall can succeed, yet write less than the requested number of bytes, so the caller should retry rather than simply failing. This patch changes most of them to use util.c's safewrite wrapper, which encapsulates the process. Also, there were a few cases in which the retry loop was open-coded, and I replaced those, too. * Makefile.maint (sc_avoid_write): New rule, to avoid recurrence. * .x-sc_avoid_write: New file. Record two legitimate exemptions. * qemud/qemud.c (sig_handler, qemudClientWriteBuf): Use safewrite, not write. * src/conf.c (__virConfWriteFile): Likewise. * src/qemu_conf.c (qemudSaveConfig, qemudSaveNetworkConfig): Likewise. * src/qemu_driver.c (qemudWaitForMonitor, qemudStartVMDaemon) (qemudVMData, PROC_IP_FORWARD): Likewise. * proxy/libvirt_proxy.c: Include "util.h". (proxyWriteClientSocket): Use safewrite. * src/test.c (testDomainSave, testDomainCoreDump): Likewise. * src/proxy_internal.c (virProxyWriteClientSocket): Likewise. * src/virsh.c: Include "util-lib.h". (vshOutputLogFile): Use safewrite. * src/console.c: Include "util-lib.h". (vshRunConsole): Use safewrite.
Diffstat (limited to '.x-sc_avoid_write')
-rw-r--r--.x-sc_avoid_write2
1 files changed, 2 insertions, 0 deletions
diff --git a/.x-sc_avoid_write b/.x-sc_avoid_write
new file mode 100644
index 000000000..72a196d13
--- /dev/null
+++ b/.x-sc_avoid_write
@@ -0,0 +1,2 @@
+^src/util\.c$
+^src/xend_internal\.c$