Cleanup: add missing dot
[lttng-tools.git] / src / bin / lttng-relayd / cmd-generic.c
1 /*
2 * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
3 * David Goulet <dgoulet@efficios.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License, version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #define _GNU_SOURCE
20 #include <assert.h>
21
22 #include <common/common.h>
23
24 #include "cmd-generic.h"
25
26 int cmd_recv(struct lttcomm_sock *sock, void *buf, size_t len)
27 {
28 int ret;
29
30 assert(sock);
31 assert(buf);
32
33 ret = sock->ops->recvmsg(sock, buf, len, 0);
34 if (ret < len) {
35 if (ret == 0) {
36 /* Orderly shutdown. Not necessary to print an error. */
37 DBG("Socket %d did an orderly shutdown", sock->fd);
38 } else {
39 ERR("Relay didn't receive valid add_stream struct size. "
40 "Expected %zu, got %d", len, ret);
41 }
42 ret = -1;
43 goto error;
44 }
45
46 error:
47 return ret;
48 }
This page took 0.029677 seconds and 4 git commands to generate.