Skip to contentSkip to conversation

Compile error

DISCUSSION Marko Saukko 3 participants 4 messages Aug 4, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

I'm getting following error when compiling the latest git version with gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3.

cc1: warnings being treated as errors
sim.c: In function ‘sim_op_retrieve_cb’:
sim.c:347: error: ignoring return value of ‘write’, declared with attribute warn_unused_result
sim.c: In function ‘sim_op_info_cb’:
sim.c:473: error: ignoring return value of ‘write’, declared with attribute warn_unused_result
make[2]: *** [sim.o] Error 1

Regards,
Marko

#1 lore raw
Quoted 4 lines · On Tue, 04 Aug 2009 08:25:09 +0300 Marko Saukko <[email protected]> wrote:

Hi,

I'm getting following error when compiling the latest git version with gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3.

Attached is a patch to fix the errors.

WARNING: It still does nothing with the return values, but it resolves the compiler errors, *that's it*.

Someone who knows something about what should happen if the write fails really ought to review and adjust this as appropriate. I am not that person.

Shane...

Quoted 1 line

From 2adb1f998dc62b9987a0b8982d0e288969710891 Mon Sep 17 00:00:00 2001

From: Shane Bryan <[email protected]>
Date: Tue, 4 Aug 2009 09:13:31 -0700
Subject: [PATCH] fix ignored return size when calling write ()

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

---
 src/sim.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
src/sim.c +4 -2
index 6e144f4..1c0666e 100644
@@ -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);
 	}
 }
Signature · 1 line
1.6.0.4
#2 lore raw

Hi,

Quoted 9 lines

On Tue, 04 Aug 2009 08:25:09 +0300

Quoted 4 lines · Marko Saukko

Hi,

I'm getting following error when compiling the latest git version with gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3.

Attached is a patch to fix the errors.

Andrew & myself have fixed this properly yesterday, the patch should now be pushed upstream.

Regards,
-Denis

#3 lore raw
Quoted 7 lines · On Tue, 4 Aug 2009 15:20:18 -0500 Denis Kenzior <[email protected]> wrote:

Hi,

Quoted 5 lines

On Tue, 04 Aug 2009 08:25:09 +0300

Quoted 2 lines · Marko Saukko

Hi,

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I'm getting following error when compiling the latest git version with gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3.

Attached is a patch to fix the errors.

Andrew & myself have fixed this properly yesterday, the patch should now be pushed upstream.

Heh, figures... I was too lazy to pull latest and check before I fired off my temp fix. Thanks for pushing a fix though!

Signature · 1 line
Shane...