Port: Replace NAME_MAX by MAXNAMLEN
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 28 Sep 2015 14:13:27 +0000 (10:13 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Fri, 16 Oct 2015 19:40:27 +0000 (15:40 -0400)
MAXNAMLEN is defined on Linux, Solaris and BSD

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/lttng-live/lttng-live-comm.c
formats/lttng-live/lttng-live-plugin.c
formats/lttng-live/lttng-live.h

index ae4f00b788fbd73c0b30886de0d161bf21729e69..eb9b8da4c3017176ca513a8fb4501c1d1fc05afa 100644 (file)
@@ -263,9 +263,9 @@ void update_session_list(GPtrArray *session_list, char *hostname,
 
        for (i = 0; i < session_list->len; i++) {
                relay_session = g_ptr_array_index(session_list, i);
 
        for (i = 0; i < session_list->len; i++) {
                relay_session = g_ptr_array_index(session_list, i);
-               if ((strncmp(relay_session->hostname, hostname, NAME_MAX) == 0) &&
+               if ((strncmp(relay_session->hostname, hostname, MAXNAMLEN) == 0) &&
                                strncmp(relay_session->name,
                                strncmp(relay_session->name,
-                                       session_name, NAME_MAX) == 0) {
+                                       session_name, MAXNAMLEN) == 0) {
                        relay_session->streams += streams;
                        if (relay_session->clients < clients)
                                relay_session->clients = clients;
                        relay_session->streams += streams;
                        if (relay_session->clients < clients)
                                relay_session->clients = clients;
@@ -277,8 +277,8 @@ void update_session_list(GPtrArray *session_list, char *hostname,
                return;
 
        relay_session = g_new0(struct lttng_live_relay_session, 1);
                return;
 
        relay_session = g_new0(struct lttng_live_relay_session, 1);
-       relay_session->hostname = strndup(hostname, NAME_MAX);
-       relay_session->name = strndup(session_name, NAME_MAX);
+       relay_session->hostname = strndup(hostname, MAXNAMLEN);
+       relay_session->name = strndup(session_name, MAXNAMLEN);
        relay_session->clients = clients;
        relay_session->streams = streams;
        relay_session->timer = timer;
        relay_session->clients = clients;
        relay_session->streams = streams;
        relay_session->timer = timer;
@@ -352,8 +352,8 @@ int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path)
                                        be32toh(lsession.live_timer));
                } else {
                        if ((strncmp(lsession.session_name, ctx->session_name,
                                        be32toh(lsession.live_timer));
                } else {
                        if ((strncmp(lsession.session_name, ctx->session_name,
-                               NAME_MAX) == 0) && (strncmp(lsession.hostname,
-                                       ctx->traced_hostname, NAME_MAX) == 0)) {
+                               MAXNAMLEN) == 0) && (strncmp(lsession.hostname,
+                                       ctx->traced_hostname, MAXNAMLEN) == 0)) {
                                printf_verbose("Reading from session %" PRIu64 "\n",
                                                session_id);
                                g_array_append_val(ctx->session_ids,
                                printf_verbose("Reading from session %" PRIu64 "\n",
                                                session_id);
                                g_array_append_val(ctx->session_ids,
index 643129c8c7c881190a9d92f3e3e5942a59014dbe..adb7249dae8e16e5a30c82b34fff9468d0536e88 100644 (file)
@@ -90,12 +90,12 @@ int setup_sighandler(void)
 }
 
 /*
 }
 
 /*
- * hostname parameter needs to hold NAME_MAX chars.
+ * hostname parameter needs to hold MAXNAMLEN chars.
  */
 static
 int parse_url(const char *path, struct lttng_live_ctx *ctx)
 {
  */
 static
 int parse_url(const char *path, struct lttng_live_ctx *ctx)
 {
-       char remain[3][NAME_MAX];
+       char remain[3][MAXNAMLEN];
        int ret = -1, proto, proto_offset = 0;
        size_t path_len = strlen(path); /* not accounting \0 */
 
        int ret = -1, proto, proto_offset = 0;
        size_t path_len = strlen(path); /* not accounting \0 */
 
@@ -104,7 +104,7 @@ int parse_url(const char *path, struct lttng_live_ctx *ctx)
         * against a size defined by a macro. Test it beforehand on the
         * input. We know the output is always <= than the input length.
         */
         * against a size defined by a macro. Test it beforehand on the
         * input. We know the output is always <= than the input length.
         */
-       if (path_len >= NAME_MAX) {
+       if (path_len >= MAXNAMLEN) {
                goto end;
        }
        ret = sscanf(path, "net%d://", &proto);
                goto end;
        }
        ret = sscanf(path, "net%d://", &proto);
index c4641df7c62bc934896ea3ac0d81d49ca8bc5d92..4ab641d59609dceb6d53d2a9cfa4f12f9835d467 100644 (file)
@@ -33,9 +33,9 @@
 #define LTTNG_LIVE_MINOR                       4
 
 struct lttng_live_ctx {
 #define LTTNG_LIVE_MINOR                       4
 
 struct lttng_live_ctx {
-       char traced_hostname[NAME_MAX];
-       char session_name[NAME_MAX];
-       char relay_hostname[NAME_MAX];
+       char traced_hostname[MAXNAMLEN];
+       char session_name[MAXNAMLEN];
+       char relay_hostname[MAXNAMLEN];
        int control_sock;
        int port;
        /* Protocol version to use for this connection. */
        int control_sock;
        int port;
        /* Protocol version to use for this connection. */
This page took 0.029611 seconds and 4 git commands to generate.