summaryrefslogtreecommitdiff
path: root/usr.sbin/switchd
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2016-07-19 18:11:09 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2016-07-19 18:11:09 +0000
commit164a0a86145b81cbec328d5e41e53ca68f70d30d (patch)
tree693dcb8ab0f9f3f6af626f9af7ba41efcf59e6d4 /usr.sbin/switchd
parenta5219241caf4d7b9e9f207505d16fba973fd729d (diff)
Correctly use ssize_t instead of size_t for read/write return values.
Pointed out by David Hill and clang.
Diffstat (limited to 'usr.sbin/switchd')
-rw-r--r--usr.sbin/switchd/ofcconn.c7
-rw-r--r--usr.sbin/switchd/ofp.c4
-rw-r--r--usr.sbin/switchd/ofp10.c4
3 files changed, 8 insertions, 7 deletions
diff --git a/usr.sbin/switchd/ofcconn.c b/usr.sbin/switchd/ofcconn.c
index c08d21fb9ad..4583d17c2e3 100644
--- a/usr.sbin/switchd/ofcconn.c
+++ b/usr.sbin/switchd/ofcconn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofcconn.c,v 1.3 2016/07/19 18:04:04 reyk Exp $ */
+/* $OpenBSD: ofcconn.c,v 1.4 2016/07/19 18:11:08 reyk Exp $ */
/*
* Copyright (c) 2016 YASUOKA Masahiko <yasuoka@openbsd.org>
@@ -311,7 +311,7 @@ ofcconn_on_devfio(int fd, short evmask, void *ctx)
{
struct ofcconn *oc = ctx;
static char buf[65536];/* max size of OpenFlow message */
- size_t sz, sz2;
+ ssize_t sz, sz2;
struct ofp_header *hdr;
if (evmask & EV_WRITE) {
@@ -500,7 +500,8 @@ ofcconn_send_hello(struct ofcconn *oc)
hdr.oh_length = htons(sizeof(hdr));
hdr.oh_xid = htonl(0xffffffffUL);
- if ((sz = write(oc->oc_sock, &hdr, sizeof(hdr))) != sz) {
+ sz = sizeof(hdr);
+ if (write(oc->oc_sock, &hdr, sz) != sz) {
log_warn("%s: %s write", __func__, oc->oc_device);
ofcconn_close(oc);
ofcconn_connect_again(oc);
diff --git a/usr.sbin/switchd/ofp.c b/usr.sbin/switchd/ofp.c
index 1efe9c8ff64..eeb72357839 100644
--- a/usr.sbin/switchd/ofp.c
+++ b/usr.sbin/switchd/ofp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofp.c,v 1.1 2016/07/19 16:54:26 reyk Exp $ */
+/* $OpenBSD: ofp.c,v 1.2 2016/07/19 18:11:08 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -208,7 +208,7 @@ ofp_send(struct switch_connection *con, struct ofp_header *oh,
struct iovec iov[2];
int cnt = 0;
void *data;
- size_t len;
+ ssize_t len;
if (oh != NULL) {
iov[cnt].iov_base = oh;
diff --git a/usr.sbin/switchd/ofp10.c b/usr.sbin/switchd/ofp10.c
index 2a27e061f06..bd89686b2df 100644
--- a/usr.sbin/switchd/ofp10.c
+++ b/usr.sbin/switchd/ofp10.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofp10.c,v 1.1 2016/07/19 16:54:26 reyk Exp $ */
+/* $OpenBSD: ofp10.c,v 1.2 2016/07/19 18:11:08 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -170,7 +170,7 @@ ofp10_debug_packet_out(struct switchd *sc,
off += sizeof(*pout);
while ((ah = ibuf_seek(ibuf, off, len)) != NULL &&
- ntohs(ah->ah_len) >= sizeof(*ah)) {
+ ntohs(ah->ah_len) >= (uint16_t)sizeof(*ah)) {
switch (ntohs(ah->ah_type)) {
case OFP10_ACTION_OUTPUT:
ao = (struct ofp10_action_output *)ah;