[PATCH] fix ignored return size when calling write ()

Shane Bryan shane.bryan at linux.intel.com
Tue Aug 4 09:13:31 PDT 2009


 sim.c uses write () but ignores the size returned. This causes
 compile failures with default options generated with bootstrap

Signed-off-by: Shane Bryan <shane.bryan at linux.intel.com>
---
 src/sim.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sim.c b/src/sim.c
index 6e144f4..1c0666e 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -312,6 +312,7 @@ static void sim_op_retrieve_cb(const struct ofono_error *error,
 	char *imsi = sim->imsi;
 	char *path;
 	int fd;
+	ssize_t w_size;
 
 	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
 		sim_op_error(modem);
@@ -333,7 +334,7 @@ static void sim_op_retrieve_cb(const struct ofono_error *error,
 		if (lseek(fd, (op->current - 1) * op->record_length +
 					SIM_CACHE_HEADER_SIZE, SEEK_SET) !=
 				(off_t) -1)
-			write(fd, data, op->record_length);
+			w_size = write(fd, data, op->record_length);
 		close(fd);
 	}
 
@@ -409,6 +410,7 @@ static void sim_op_info_cb(const struct ofono_error *error, int length,
 	enum sim_file_access update;
 	enum sim_file_access invalidate;
 	enum sim_file_access rehabilitate;
+	ssize_t w_size;
 
 	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
 		sim_op_error(modem);
@@ -459,7 +461,7 @@ static void sim_op_info_cb(const struct ofono_error *error, int length,
 		fileinfo[4] = record_length >> 8;
 		fileinfo[5] = record_length & 0xff;
 
-		write(fd, fileinfo, 6);
+		w_size = write(fd, fileinfo, 6);
 		close(fd);
 	}
 }
-- 
1.6.0.4


--MP_/T/kcYj3=AXu00UpAW3x2cgH--


More information about the ofono mailing list