[Vm-dev] [Fix] Avoid recent gcc error messages about
unused write(2) return value
Gavin Romig-Koch
gavin at redhat.com
Tue Feb 3 16:38:41 UTC 2009
Damien Cassou wrote:
>
> [Fix] Avoid recent gcc error messages about unused write(2) return value
>
>
What a mess: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
with the additional fact that the makefile in vm-display-fbdev turns on
-Werror.
In any case, if this code has to be changed, I think it would be better
in this case to check the return values than to go to extra ordinary
lengths to ignore them. Patch attached.
-gavin...
-------------- next part --------------
Index: platforms/unix/vm-display-fbdev/sqUnixFBDevMousePS2.c
===================================================================
--- platforms/unix/vm-display-fbdev/sqUnixFBDevMousePS2.c (revision 1966)
+++ platforms/unix/vm-display-fbdev/sqUnixFBDevMousePS2.c (working copy)
@@ -110,11 +110,15 @@
for (i= 0; i < len; ++i)
{
resend:
- (void)write(self->fd, command + i, 1);
+ if (1 != write(self->fd, command + i, 1))
+ {
+ dprintf("%s: send failed during write\n", self->msName);
+ return 0;
+ }
dprintf(">%02x\n", command[i]);
if (1 != ms_read(self, buf, 1, 1, PS2_SEND_DELAY))
{
- dprintf("%s: send failed\n", self->msName);
+ dprintf("%s: send failed during read\n", self->msName);
return 0;
}
switch (buf[0])
@@ -141,7 +145,11 @@
{
unsigned char command[]= { PS2_DISABLE };
dprintf("%s: disable\n", self->msName);
- (void)write(self->fd, command, 1);
+ if (1 != write(self->fd, command, 1))
+ {
+ dprintf("%s: disable failed during write\n", self->msName);
+ return;
+ }
dprintf(">%02x\n", command[0]);
while (1 == ms_read(self, command, 1, 1, PS2_DISABLE_DELAY))
if (PS2_OK == command[0])
More information about the Vm-dev
mailing list