[Xorg-driver-geode] [PATCH] DCONDPMSSet: handle error return code on "write" to avoid a warning

Gaetan Nadon memsize at videotron.ca
Tue Nov 29 09:02:32 PST 2011


The author of the write() system call has deemed important for the caller
to check the return code. If not, the compiler issues a warning.

The patch handles a bad return code from write() just in the same way
as the code does for the open() calls.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
	The patch has not been tested on a Geode system.

 src/geode_dcon.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/geode_dcon.c b/src/geode_dcon.c
index 56f05ed..9009293 100644
--- a/src/geode_dcon.c
+++ b/src/geode_dcon.c
@@ -101,9 +101,14 @@ DCONDPMSSet(ScrnInfoPtr pScrni, int mode)
 	break;
     }
 
-    write(fd, value, sizeof(value));
+    ret = write(fd, value, sizeof(value));
     close(fd);
 
+    if (ret < 0) {
+	failed = 1;
+	return 0;
+    }
+
     return 1;
 }
 
-- 
1.7.4.1



More information about the Xorg-driver-geode mailing list