From: Jens Axboe Date: Thu, 22 Mar 2018 01:01:33 +0000 (-0600) Subject: Merge branch 'include_refactor' of https://github.com/sitsofe/fio X-Git-Tag: fio-3.6~28 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=ec2ea18e87fad6c42d6875cd4ee1bb25ef9b4627;hp=c473a9bd8fadf0b8e7521edcabb2204d87f35b04 Merge branch 'include_refactor' of https://github.com/sitsofe/fio * 'include_refactor' of https://github.com/sitsofe/fio: Add include-what-you-use pragmas oslib: make str* compat functions more uniform Use POSIX path for poll.h and fcntl.h headers Refactor #includes and headers --- diff --git a/server.c b/server.c index 3592ab17..ebb97dc7 100644 --- a/server.c +++ b/server.c @@ -526,6 +526,9 @@ static struct sk_entry *fio_net_prep_cmd(uint16_t opcode, void *buf, struct sk_entry *entry; entry = smalloc(sizeof(*entry)); + if (!entry) + return NULL; + INIT_FLIST_HEAD(&entry->next); entry->opcode = opcode; if (flags & SK_F_COPY) { @@ -614,7 +617,7 @@ static int fio_net_queue_quit(void) { dprint(FD_NET, "server: sending quit\n"); - return fio_net_queue_cmd(FIO_NET_CMD_QUIT, NULL, 0, NULL, SK_F_SIMPLE | SK_F_INLINE); + return fio_net_queue_cmd(FIO_NET_CMD_QUIT, NULL, 0, NULL, SK_F_SIMPLE); } int fio_net_send_quit(int sk) @@ -634,7 +637,7 @@ static int fio_net_send_ack(struct fio_net_cmd *cmd, int error, int signal) epdu.error = __cpu_to_le32(error); epdu.signal = __cpu_to_le32(signal); - return fio_net_queue_cmd(FIO_NET_CMD_STOP, &epdu, sizeof(epdu), &tag, SK_F_COPY | SK_F_INLINE); + return fio_net_queue_cmd(FIO_NET_CMD_STOP, &epdu, sizeof(epdu), &tag, SK_F_COPY); } static int fio_net_queue_stop(int error, int signal) @@ -1357,6 +1360,11 @@ static int accept_loop(int listen_sk) dprint(FD_NET, "server: connect from %s\n", from); sk_out = smalloc(sizeof(*sk_out)); + if (!sk_out) { + close(sk); + return -1; + } + sk_out->sk = sk; INIT_FLIST_HEAD(&sk_out->list); __fio_sem_init(&sk_out->lock, FIO_SEM_UNLOCKED);