Clean-up: use LTTNG_PATH_MAX rather than PATH_MAX
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 5 Mar 2018 16:09:42 +0000 (11:09 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 5 Mar 2018 16:12:45 +0000 (11:12 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/consumer.h
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-consumer.c

index 6351ebe32f47431c0f6490bd6edd23ba3b8a0c37..5f551e31dd5a05d6283e0aca2cbe01ca660096b4 100644 (file)
@@ -561,7 +561,7 @@ struct consumer_output *consumer_copy_output(struct consumer_output *obj)
        }
        output->enabled = obj->enabled;
        output->net_seq_index = obj->net_seq_index;
-       memcpy(output->subdir, obj->subdir, PATH_MAX);
+       memcpy(output->subdir, obj->subdir, sizeof(output->subdir));
        output->snapshot = obj->snapshot;
        output->relay_major_version = obj->relay_major_version;
        output->relay_minor_version = obj->relay_minor_version;
index ddc94d7148e5c3cc91be34f98b0a924374862fba..24c7a273c6dab0246b128d16456b4e1e41d76868 100644 (file)
@@ -169,7 +169,7 @@ struct consumer_output {
         * Subdirectory path name used for both local and network
         * consumer (/kernel or /ust).
         */
-       char subdir[PATH_MAX];
+       char subdir[LTTNG_PATH_MAX];
 
        /*
         * Hashtable of consumer_socket index by the file descriptor value. For
@@ -182,7 +182,7 @@ struct consumer_output {
        unsigned int snapshot:1;
 
        union {
-               char session_root_path[PATH_MAX];
+               char session_root_path[LTTNG_PATH_MAX];
                struct consumer_net net;
        } dst;
 
@@ -190,7 +190,7 @@ struct consumer_output {
         * Sub-directory below the session_root_path where the next chunk of
         * trace will be stored (\0 before the first session rotation).
         */
-       char chunk_path[PATH_MAX];
+       char chunk_path[LTTNG_PATH_MAX];
 };
 
 struct consumer_socket *consumer_find_socket(int key,
index 9112cd14e39cf37cafb1d904d3bada5042cfe00b..0db0eb17382077d34fd95e0790acba624047ad98 100644 (file)
@@ -4420,18 +4420,18 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
                        usess->consumer->dst.session_root_path[0] != '\0') {
                char *tmp_path;
 
-               tmp_path = zmalloc(PATH_MAX * sizeof(char));
+               tmp_path = zmalloc(LTTNG_PATH_MAX);
                if (!tmp_path) {
                        ERR("Alloc tmp_path");
                        goto error_unlock;
                }
-               ret = snprintf(tmp_path, PATH_MAX, "%s%s%s",
+               ret = snprintf(tmp_path, LTTNG_PATH_MAX, "%s%s%s",
                                usess->consumer->dst.session_root_path,
                                usess->consumer->chunk_path,
                                usess->consumer->subdir);
-               if (ret >= PATH_MAX) {
+               if (ret >= LTTNG_PATH_MAX) {
                        ERR("Local destination path exceeds the maximal allowed length of %i bytes (needs %i bytes) with path = \"%s%s%s\"",
-                                       PATH_MAX, ret,
+                                       LTTNG_PATH_MAX, ret,
                                        usess->consumer->dst.session_root_path,
                                        usess->consumer->chunk_path,
                                        usess->consumer->subdir);
index eac9956574e6c9e9b284c7d8ef6dd12e9768a370..d8d6c329f5d3334555f05e0418a699c46cec6dce 100644 (file)
@@ -53,8 +53,11 @@ static char *setup_trace_path(struct consumer_output *consumer,
 
        health_code_update();
 
-       /* Allocate our self the string to make sure we never exceed PATH_MAX. */
-       pathname = zmalloc(PATH_MAX);
+       /*
+        * Allocate the string ourself to make sure we never exceed
+        * LTTNG_PATH_MAX.
+        */
+       pathname = zmalloc(LTTNG_PATH_MAX);
        if (!pathname) {
                goto error;
        }
@@ -62,7 +65,7 @@ static char *setup_trace_path(struct consumer_output *consumer,
        /* Get correct path name destination */
        if (consumer->type == CONSUMER_DST_LOCAL) {
                /* Set application path to the destination path */
-               ret = snprintf(pathname, PATH_MAX, "%s%s%s%s",
+               ret = snprintf(pathname, LTTNG_PATH_MAX, "%s%s%s%s",
                                consumer->dst.session_root_path,
                                consumer->chunk_path,
                                consumer->subdir, ua_sess->path);
@@ -81,7 +84,7 @@ static char *setup_trace_path(struct consumer_output *consumer,
                        }
                }
        } else {
-               ret = snprintf(pathname, PATH_MAX, "%s%s%s%s",
+               ret = snprintf(pathname, LTTNG_PATH_MAX, "%s%s%s%s",
                                consumer->dst.net.base_dir,
                                consumer->chunk_path,
                                consumer->subdir,
This page took 0.03108 seconds and 5 git commands to generate.