summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Duncan <lduncan@suse.com>2020-01-29 10:11:36 -0800
committerLee Duncan <lduncan@suse.com>2020-01-29 10:11:36 -0800
commit6827b8dd191e1e94402871dba9cde9ecb076143a (patch)
treecea07f9485bb0d083a99b72c3b403a4f987d1fdf
parent499a006a7d6bb154f9e1ab430e4c9e231ba6096a (diff)
downloadopen-iscsi-6827b8dd191e1e94402871dba9cde9ecb076143a.tar.gz
Fix 586 compiler issues.
Now that "-Werror" is turned on, 32-bit x86 compile problems are fatal, so fix them. *Should* be no functional change.
-rw-r--r--iscsiuio/src/unix/main.c21
-rw-r--r--iscsiuio/src/unix/nic_utils.c2
-rw-r--r--usr/Makefile2
-rw-r--r--usr/actor.c5
-rw-r--r--usr/discoveryd.c2
-rw-r--r--usr/iscsiadm.c5
-rw-r--r--usr/iscsid_req.c5
-rw-r--r--usr/local_strings.c2
-rw-r--r--usr/netlink.c2
9 files changed, 27 insertions, 19 deletions
diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c
index 5e3f66c..0c9ad49 100644
--- a/iscsiuio/src/unix/main.c
+++ b/iscsiuio/src/unix/main.c
@@ -51,6 +51,7 @@
#ifndef NO_SYSTEMD
#include <systemd/sd-daemon.h>
#endif
+#include <assert.h>
#include "uip.h"
#include "uip_arp.h"
@@ -186,16 +187,17 @@ static void main_usage()
static void daemon_init()
{
int fd;
+ int res;
fd = open("/dev/null", O_RDWR);
- if (fd == -1)
- exit(-1);
+ assert(fd >= 0);
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
setsid();
- chdir("/");
+ res = chdir("/");
+ assert(res == 0);
close(fd);
}
@@ -338,10 +340,12 @@ int main(int argc, char *argv[])
exit(1);
} else if (pid) {
char msgbuf[4];
+ int res;
/* parent: wait for child msg then exit */
- close(pipefds[1]);
- read(pipefds[0], msgbuf, sizeof(msgbuf));
+ close(pipefds[1]); /* close unused end */
+ res = read(pipefds[0], msgbuf, sizeof(msgbuf));
+ assert(res > 0);
exit(0);
}
@@ -414,9 +418,12 @@ int main(int argc, char *argv[])
goto error;
if (!foreground) {
+ int res;
+
/* signal parent they can go away now */
- close(pipefds[0]);
- write(pipefds[1], "ok\n", 3);
+ close(pipefds[0]); /* close unused end */
+ res = write(pipefds[1], "ok\n", 3);
+ assert(res > 0);
close(pipefds[1]);
}
diff --git a/iscsiuio/src/unix/nic_utils.c b/iscsiuio/src/unix/nic_utils.c
index 84ffc5c..ec3b915 100644
--- a/iscsiuio/src/unix/nic_utils.c
+++ b/iscsiuio/src/unix/nic_utils.c
@@ -1252,7 +1252,7 @@ int get_iscsi_transport_handle(nic_t *nic, uint64_t *handle)
if (rc != 0)
goto error;
- elements_read = sscanf(raw, "%lu", handle);
+ elements_read = sscanf(raw, "%" PRIu64, handle);
if (elements_read != 1) {
LOG_ERR(PFX "%s: Couldn't parse transport handle from %s",
nic->log_name, temp_path);
diff --git a/usr/Makefile b/usr/Makefile
index 7ab1b0b..21bb154 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -35,7 +35,7 @@ endif
PKG_CONFIG = /usr/bin/pkg-config
CFLAGS ?= -O2 -g
-WARNFLAGS ?= -Wall -Wextra -Werror -Wstrict-prototypes
+WARNFLAGS ?= -Wall -Wextra -Werror -Wstrict-prototypes -fno-common
CFLAGS += $(WARNFLAGS) -I../include -I. -D_GNU_SOURCE \
-I$(TOPDIR)/libopeniscsiusr
CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod)
diff --git a/usr/actor.c b/usr/actor.c
index 1a0a5ff..000e66a 100644
--- a/usr/actor.c
+++ b/usr/actor.c
@@ -239,7 +239,8 @@ actor_poll(void)
uint64_t time_left = actor_time_left(thread, current_time);
if (time_left) {
log_debug(7, "thread %08lx due %" PRIu64 ", wait %" PRIu64 " more",
- (long)thread, thread->ttschedule, time_left);
+ (long)thread,
+ (uint64_t)thread->ttschedule, time_left);
alarm(time_left);
break;
@@ -251,7 +252,7 @@ actor_poll(void)
log_debug(2, "thread %08lx was scheduled for "
"%" PRIu64 ", curtime %" PRIu64 " q_forw %p "
"&pend_list %p",
- (long)thread, thread->ttschedule,
+ (long)thread, (uint64_t)thread->ttschedule,
current_time, pend_list.next, &pend_list);
list_add_tail(&thread->list, &ready_list);
diff --git a/usr/discoveryd.c b/usr/discoveryd.c
index 39d3691..08eb2bb 100644
--- a/usr/discoveryd.c
+++ b/usr/discoveryd.c
@@ -488,7 +488,7 @@ static void isns_reg_refresh_by_eid_qry(void *data)
int status, timeout;
log_debug(1, "Refresh registration using eid qry");
- if (refresh_data->start_time + refresh_data->interval <= time(NULL)) {
+ if ((time_t)(refresh_data->start_time + refresh_data->interval) <= time(NULL)) {
log_error("Could not refresh registration with server "
"before registration period. Starting new "
"registration.");
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 9bb7f49..8ff4d47 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -2677,7 +2677,8 @@ delete_fail:
memset(&hinfo, 0, sizeof(struct host_info));
hinfo.host_no = host_no;
if (iscsi_sysfs_get_hostinfo_by_host_no(&hinfo)) {
- log_error("Could not match host%lu to ifaces.", host_no);
+ log_error("Could not match host%" PRIu64 " to ifaces.",
+ host_no);
rc = ISCSI_ERR_INVAL;
break;
}
@@ -2688,7 +2689,7 @@ delete_fail:
break;
}
- printf("Applied settings to ifaces attached to host%lu.\n",
+ printf("Applied settings to ifaces attached to host%" PRIu64 ".\n",
host_no);
break;
default:
diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
index 4e5e3da..3bbf5b9 100644
--- a/usr/iscsid_req.c
+++ b/usr/iscsid_req.c
@@ -299,9 +299,8 @@ int uip_broadcast(void *buf, size_t buf_len, int fd_flags, uint32_t *status)
/* Wait for the response */
err = read(fd, &rsp, sizeof(rsp));
if (err == sizeof(rsp)) {
- log_debug(3, "Broadcasted to uIP with length: %ld "
- "cmd: 0x%x rsp: 0x%x", buf_len,
- rsp.command, rsp.err);
+ log_debug(3, "Broadcasted to uIP with length: %zu cmd: 0x%x rsp: 0x%x",
+ buf_len, rsp.command, rsp.err);
err = 0;
break;
} else if ((err == -1) && (errno == EAGAIN)) {
diff --git a/usr/local_strings.c b/usr/local_strings.c
index d0feb6d..2a40c2a 100644
--- a/usr/local_strings.c
+++ b/usr/local_strings.c
@@ -74,7 +74,7 @@ int str_enlarge_data(struct str_buffer *s, int length)
if (s) {
s->data_length += length;
if (s->data_length > s->allocated_length) {
- log_debug(7, "enlarge buffer from %lu to %lu",
+ log_debug(7, "enlarge buffer from %zu to %zu",
s->allocated_length, s->data_length);
new_buf = realloc(s->buffer, s->data_length);
if (!new_buf) {
diff --git a/usr/netlink.c b/usr/netlink.c
index 662b621..d42ca4f 100644
--- a/usr/netlink.c
+++ b/usr/netlink.c
@@ -137,7 +137,7 @@ nlpayload_read(int ctrl_fd, char *data, int count, int flags)
iov.iov_len = NLMSG_SPACE(count);
if (iov.iov_len > NLM_BUF_DEFAULT_MAX) {
- log_error("Cannot read %lu bytes. nlm_recvbuf too small.",
+ log_error("Cannot read %zu bytes. nlm_recvbuf too small.",
iov.iov_len);
return -1;
}