[PATCH] uemis-downloader.c: fix some read() and write() warnings
Lubomir I. Ivanov
neolit123 at gmail.com
Wed Oct 9 04:15:32 UTC 2013
From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
Patch fixes warnings for read() and write() not returning
to a variable:
"ignoring return value of write, declared with attribute
warn_unused_result [-Wunused-result]"
Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
uemis-downloader.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/uemis-downloader.c b/uemis-downloader.c
index eced216..a9996e2 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -188,7 +188,7 @@ static bool uemis_init(const char *path)
}
if (bytes_available(reqtxt_file) > 5) {
char tmp[6];
- read(reqtxt_file, tmp, 5);
+ int ret = read(reqtxt_file, tmp, 5);
tmp[5] = '\0';
#if UEMIS_DEBUG & 2
fprintf(debugfile, "::r req.txt \"%s\"\n", tmp);
@@ -235,9 +235,9 @@ static void trigger_response(int file, char *command, int nr, long tailpos)
fprintf(debugfile,":tr %s (after seeks)\n", fl);
#endif
lseek(file, 0, SEEK_SET);
- write(file, fl, strlen(fl));
+ int ret = write(file, fl, strlen(fl));
lseek(file, tailpos, SEEK_SET);
- write(file, fl + 1, strlen(fl + 1));
+ ret = write(file, fl + 1, strlen(fl + 1));
#ifndef WIN32
fsync(file);
#endif
@@ -427,7 +427,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
snprintf(fl, 13, "ANS%d.TXT", filenr - 1);
ans_path = build_filename(build_filename(path, "ANS"), fl);
ans_file = open(ans_path, O_RDONLY, 0666);
- read(ans_file, tmp, 100);
+ int ret = read(ans_file, tmp, 100);
close(ans_file);
#if UEMIS_DEBUG & 8
tmp[100]='\0';
@@ -478,7 +478,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
if (size > 3) {
char *buf = malloc(size - 2);
lseek(ans_file, 3, SEEK_CUR);
- read(ans_file, buf, size - 3);
+ int ret = read(ans_file, buf, size - 3);
buf[size - 3] = '\0';
buffer_add(&mbuf, &mbuf_size, buf);
show_progress(buf, what);
@@ -502,7 +502,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
if (size > 3) {
buf = malloc(size - 2);
lseek(ans_file, 3, SEEK_CUR);
- read(ans_file, buf, size - 3);
+ int ret = read(ans_file, buf, size - 3);
buf[size - 3] = '\0';
buffer_add(&mbuf, &mbuf_size, buf);
show_progress(buf, what);
--
1.7.11.msysgit.0
More information about the subsurface
mailing list