X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng-sessiond%2Fmain.c;h=0a78f27bad9e9e6f85ad9e86008030464b924a39;hp=7e58ff781ee86d481458657ddba725f30c102d49;hb=7745933c95eb803f0aca1489bfaf26e83239c219;hpb=ebaeda9495ef97ec81d9f7dd66eccdb32f116cee diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 7e58ff781..0a78f27ba 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -192,7 +192,7 @@ void setup_consumerd_path(void) */ #if (CAA_BITS_PER_LONG == 32) if (!consumerd32_path[0]) { - consumerd32_bindir = INSTALL_BIN_PATH "/" CONSUMERD_FILE; + consumerd32_path = INSTALL_BIN_PATH "/" CONSUMERD_FILE; } if (!consumerd32_libdir[0]) { consumerd32_libdir = INSTALL_LIB_PATH; @@ -1532,18 +1532,88 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data) break; case LTTNG_CONSUMER64_UST: { - execl(consumerd64_path, verbosity, "-u", + char *tmpnew; + + if (consumerd64_libdir[0] != '\0') { + char *tmp; + size_t tmplen; + + tmp = getenv("LD_LIBRARY_PATH"); + if (!tmp) { + tmp = ""; + } + tmplen = strlen("LD_LIBRARY_PATH=") + + strlen(consumerd64_libdir) + 1 /* : */ + strlen(tmp); + tmpnew = zmalloc(tmplen + 1 /* \0 */); + if (!tmpnew) { + ret = -ENOMEM; + goto error; + } + strcpy(tmpnew, "LD_LIBRARY_PATH="); + strcat(tmpnew, consumerd64_libdir); + if (tmp[0] != '\0') { + strcat(tmpnew, ":"); + strcat(tmpnew, tmp); + } + ret = putenv(tmpnew); + if (ret) { + ret = -errno; + goto error; + } + } + ret = execl(consumerd64_path, verbosity, "-u", "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path, "--consumerd-err-sock", consumer_data->err_unix_sock_path, NULL); + if (consumerd64_libdir[0] != '\0') { + free(tmpnew); + } + if (ret) { + goto error; + } break; } case LTTNG_CONSUMER32_UST: { - execl(consumerd32_path, verbosity, "-u", + char *tmpnew; + + if (consumerd32_libdir[0] != '\0') { + char *tmp; + size_t tmplen; + + tmp = getenv("LD_LIBRARY_PATH"); + if (!tmp) { + tmp = ""; + } + tmplen = strlen("LD_LIBRARY_PATH=") + + strlen(consumerd32_libdir) + 1 /* : */ + strlen(tmp); + tmpnew = zmalloc(tmplen + 1 /* \0 */); + if (!tmpnew) { + ret = -ENOMEM; + goto error; + } + strcpy(tmpnew, "LD_LIBRARY_PATH="); + strcat(tmpnew, consumerd32_libdir); + if (tmp[0] != '\0') { + strcat(tmpnew, ":"); + strcat(tmpnew, tmp); + } + ret = putenv(tmpnew); + if (ret) { + ret = -errno; + goto error; + } + } + ret = execl(consumerd32_path, verbosity, "-u", "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path, "--consumerd-err-sock", consumer_data->err_unix_sock_path, NULL); + if (consumerd32_libdir[0] != '\0') { + free(tmpnew); + } + if (ret) { + goto error; + } break; } default: @@ -1560,6 +1630,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data) perror("start consumer fork"); ret = -errno; } +error: return ret; }