* fallback on the 32-bit one,
*/
DBG3("Looking for a kernel consumer at these locations:");
- DBG3(" 1) %s", config.consumerd64_bin_path.value);
+ DBG3(" 1) %s", config.consumerd64_bin_path.value ? : "NULL");
DBG3(" 2) %s/%s", INSTALL_BIN_PATH, DEFAULT_CONSUMERD_FILE);
- DBG3(" 3) %s", config.consumerd32_bin_path.value);
+ DBG3(" 3) %s", config.consumerd32_bin_path.value ? : "NULL");
if (stat(config.consumerd64_bin_path.value, &st) == 0) {
DBG3("Found location #1");
consumer_to_use = config.consumerd64_bin_path.value;
{
char *tmpnew = NULL;
- if (config.consumerd64_lib_dir.value[0] != '\0') {
+ if (config.consumerd64_lib_dir.value) {
char *tmp;
size_t tmplen;
if (!tmp) {
tmp = "";
}
- tmplen = strlen("LD_LIBRARY_PATH=")
- + strlen(config.consumerd64_lib_dir.value) + 1 /* : */ + strlen(tmp);
+ tmplen = strlen(config.consumerd64_lib_dir.value) + 1 /* : */ + strlen(tmp);
tmpnew = zmalloc(tmplen + 1 /* \0 */);
if (!tmpnew) {
ret = -ENOMEM;
goto error;
}
- strcpy(tmpnew, "LD_LIBRARY_PATH=");
strcat(tmpnew, config.consumerd64_lib_dir.value);
if (tmp[0] != '\0') {
strcat(tmpnew, ":");
strcat(tmpnew, tmp);
}
- ret = putenv(tmpnew);
+ ret = setenv("LD_LIBRARY_PATH", tmpnew, 1);
if (ret) {
ret = -errno;
free(tmpnew);
"--consumerd-err-sock", consumer_data->err_unix_sock_path,
"--group", config.tracing_group_name.value,
NULL);
- if (config.consumerd64_lib_dir.value[0] != '\0') {
- free(tmpnew);
- }
+ free(tmpnew);
break;
}
case LTTNG_CONSUMER32_UST:
{
char *tmpnew = NULL;
- if (config.consumerd32_lib_dir.value[0] != '\0') {
+ if (config.consumerd32_lib_dir.value) {
char *tmp;
size_t tmplen;
if (!tmp) {
tmp = "";
}
- tmplen = strlen("LD_LIBRARY_PATH=")
- + strlen(config.consumerd32_lib_dir.value) + 1 /* : */ + strlen(tmp);
+ tmplen = strlen(config.consumerd32_lib_dir.value) + 1 /* : */ + strlen(tmp);
tmpnew = zmalloc(tmplen + 1 /* \0 */);
if (!tmpnew) {
ret = -ENOMEM;
goto error;
}
- strcpy(tmpnew, "LD_LIBRARY_PATH=");
strcat(tmpnew, config.consumerd32_lib_dir.value);
if (tmp[0] != '\0') {
strcat(tmpnew, ":");
strcat(tmpnew, tmp);
}
- ret = putenv(tmpnew);
+ ret = setenv("LD_LIBRARY_PATH", tmpnew, 1);
if (ret) {
ret = -errno;
free(tmpnew);
"--consumerd-err-sock", consumer_data->err_unix_sock_path,
"--group", config.tracing_group_name.value,
NULL);
- if (config.consumerd32_lib_dir.value[0] != '\0') {
- free(tmpnew);
- }
+ free(tmpnew);
break;
}
default:
- PERROR("unknown consumer type");
- exit(EXIT_FAILURE);
+ ERR("unknown consumer type");
+ errno = 0;
}
if (errno != 0) {
PERROR("Consumer execl()");