From 9671e6f91c5b64921c77549e2b3e3f699f6ce03b Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Thu, 31 Dec 2015 13:13:54 +0000
Subject: [PATCH] fish.c: cleanup gcc link time optimization warning
v2: consider andrew's comment
will fix gcc LTO warning at:
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 | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/vfs/fish/fish.c b/src/vfs/fish/fish.c
index 1172f31..8eb8cc8 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 | 1038 | ssize_t n; |
1039 | 1039 | |
1040 | 1040 | vfs_print_message ("%s", _("Aborting transfer...")); |
1041 | 1041 | |
1042 | | do |
| 1042 | buf = g_malloc (BUF_8K); |
| 1043 | while ((fish->total - fish->got) != 0) |
1043 | 1044 | { |
1044 | | n = MIN ((off_t) sizeof (buffer), (fish->total - fish->got)); |
1045 | | if (n != 0) |
1046 | | { |
1047 | | n = read (SUP->sockr, buffer, n); |
1048 | | if (n < 0) |
1049 | | return; |
1050 | | fish->got += n; |
1051 | | } |
| 1045 | if (sizeof (*buf) > (size_t) (fish->total - fish->got)) |
| 1046 | buf = g_try_realloc (buf, (fish->total - fish->got)); |
| 1047 | n = read (SUP->sockr, buf, sizeof (*buf)); |
| 1048 | if (n < 0) |
| 1049 | goto ret; |
| 1050 | fish->got += n; |
1052 | 1051 | } |
1053 | | while (n != 0); |
1054 | 1052 | |
1055 | 1053 | if (fish_get_reply (me, SUP->sockr, NULL, 0) != COMPLETE) |
1056 | 1054 | vfs_print_message ("%s", _("Error reported after abort.")); |
1057 | 1055 | else |
1058 | 1056 | vfs_print_message ("%s", _("Aborted transfer would be successful.")); |
| 1057 | ret: |
| 1058 | g_free(buf); |
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | /* --------------------------------------------------------------------------------------------- */ |