This website requires JavaScript.
Explore
Help
Sign In
openkylin
/
libvirt
mirror of
https://gitee.com/openkylin/libvirt.git
Watch
9
Star
0
Fork
You've already forked libvirt
0
Code
Issues
Projects
Releases
Wiki
Activity
c673689430
libvirt
/
.x-sc_avoid_write
5 lines
64 B
Plaintext
Raw
Normal View
History
Unescape
Escape
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.
2008-02-22 23:55:04 +08:00
^src/util\.c$
^src/xend_internal\.c$
Avoid new "make syntax-check" failures. * .x-sc_avoid_write: Exempt src/util-lib.c, too. * Makefile.maint (sc_unmarked_diagnostics): Filter out false positives. * src/storage_backend_fs.c (virStorageBackendFileSystemVolCreate): Use safewrite, not write. * src/storage_backend_logical.c (virStorageBackendLogicalBuildPool): Likewise.
2008-02-25 18:00:16 +08:00
^src/util-lib\.c$
exempt gnulib from write-avoidance syntax check
2008-10-29 01:42:41 +08:00
^gnulib/