summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaetan Nadon <memsize@videotron.ca>2011-11-29 12:02:32 -0500
committerMartin-Éric Racine <martin-eric.racine@iki.fi>2011-12-12 17:50:47 +0200
commit78052e0d3e28c7e6e08666d9ed2bcc64f5e93540 (patch)
treef71eb516a5923d1b2f08e95406a191696c511929
parentdb7155395e794eb276f853c7642f62727e29a0b9 (diff)
DCONDPMSSet: handle error return code on "write" to avoid a warning
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@videotron.ca>
-rw-r--r--src/geode_dcon.c7
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;
}