[Openvpn-devel,v2] manage: Fix conversion warnings in man_write
Commit Message
From: Frank Lichtenheld <frank@lichtenheld.com>
Use openvpn_send to avoid warnings due to
Windows/Unix differences.
Change-Id: I87dd41b66f7d77cab7aaf80fa9d9095e46c033d5
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2339
---
This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2339
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <razvanc@mailbox.org>
@@ -2448,11 +2448,6 @@
#endif /* ifdef TARGET_ANDROID */
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-conversion"
-#endif
-
static ssize_t
man_read(struct management *man)
{
@@ -2550,14 +2545,14 @@
static ssize_t
man_write(struct management *man)
{
- const int size_hint = 1024;
+ const size_t size_hint = 1024;
ssize_t sent = 0;
buffer_list_aggregate(man->connection.out, size_hint);
const struct buffer *buf = buffer_list_peek(man->connection.out);
- if (buf && BLEN(buf))
+ if (buf && BLEN(buf) > 0)
{
- const int len = min_int(size_hint, BLEN(buf));
+ const size_t len = min_size(size_hint, BLENZ(buf));
#ifdef TARGET_ANDROID
if (man->connection.fdtosend > 0)
{
@@ -2568,7 +2563,7 @@
else
#endif
{
- sent = send(man->connection.sd_cli, CBSTR(buf), len, MSG_NOSIGNAL);
+ sent = openvpn_send(man->connection.sd_cli, CBSTR(buf), len, MSG_NOSIGNAL);
}
if (sent >= 0)
{
@@ -2591,10 +2586,6 @@
return sent;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
static void
man_connection_clear(struct man_connection *mc)
{