Merge branch 'include_refactor' of https://github.com/sitsofe/fio
authorJens Axboe <axboe@kernel.dk>
Thu, 22 Mar 2018 01:01:33 +0000 (19:01 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 22 Mar 2018 01:01:33 +0000 (19:01 -0600)
* '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

server.c

index 3592ab176bd8feed113f8aedd12cf4b01d3d791a..ebb97dc717d302c46ff49957d3d5a441050743fe 100644 (file)
--- 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);