From b1cd6d5441af1c10951ba9524bbbcdbf2f0db529 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 19 Dec 2015 13:23:23 +0000
Subject: [PATCH] fish.c: cleanup gcc link time optimization warning
In function '__read_alias',
inlined from 'fish_linear_abort.isra.0' at fish.c:1047:15:
/usr/include/bits/unistd.h:39:9: error: call to '__read_chk_warn' declared with attribute warning: read called with bigger length than size of the destination buffer [-Werror]
return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf));
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/vfs/fish/fish.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/vfs/fish/fish.c b/src/vfs/fish/fish.c
index 1172f31..8c4401d 100644
a
|
b
|
fish_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh) |
1034 | 1034 | { |
1035 | 1035 | fish_fh_data_t *fish = (fish_fh_data_t *) fh->data; |
1036 | 1036 | struct vfs_s_super *super = FH_SUPER; |
1037 | | char buffer[BUF_8K]; |
| 1037 | char *buf; |
| 1038 | size_t bufsize = BUF_8K; |
1038 | 1039 | ssize_t n; |
1039 | 1040 | |
1040 | 1041 | vfs_print_message ("%s", _("Aborting transfer...")); |
1041 | 1042 | |
1042 | | do |
| 1043 | buf = g_malloc (bufsize * sizeof *buf); |
| 1044 | while ((fish->total - fish->got) != 0) |
1043 | 1045 | { |
1044 | | n = MIN ((off_t) sizeof (buffer), (fish->total - fish->got)); |
1045 | | if (n != 0) |
| 1046 | if (bufsize > (size_t) (fish->total - fish->got)) |
1046 | 1047 | { |
1047 | | n = read (SUP->sockr, buffer, n); |
1048 | | if (n < 0) |
1049 | | return; |
1050 | | fish->got += n; |
| 1048 | g_free(buf); |
| 1049 | bufsize = (size_t) (fish->total - fish->got); |
| 1050 | buf = g_malloc (bufsize * sizeof *buf); |
1051 | 1051 | } |
| 1052 | n = read (SUP->sockr, buf, bufsize); |
| 1053 | if (n < 0) |
| 1054 | goto ret; |
| 1055 | fish->got += n; |
1052 | 1056 | } |
1053 | | while (n != 0); |
1054 | 1057 | |
1055 | 1058 | if (fish_get_reply (me, SUP->sockr, NULL, 0) != COMPLETE) |
1056 | 1059 | vfs_print_message ("%s", _("Error reported after abort.")); |
1057 | 1060 | else |
1058 | 1061 | vfs_print_message ("%s", _("Aborted transfer would be successful.")); |
| 1062 | ret: |
| 1063 | g_free(buf); |
1059 | 1064 | } |
1060 | 1065 | |
1061 | 1066 | /* --------------------------------------------------------------------------------------------- */ |