projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Copyright ownership transfer
[lttng-tools.git]
/
src
/
lib
/
lttng-ctl
/
lttng-ctl-health.c
diff --git
a/src/lib/lttng-ctl/lttng-ctl-health.c
b/src/lib/lttng-ctl/lttng-ctl-health.c
index 91108c166b9825227248fa1e7bb00ce59b7ea7c5..5a54dfb1416c9638615494fc54000fc8755b8d69 100644
(file)
--- a/
src/lib/lttng-ctl/lttng-ctl-health.c
+++ b/
src/lib/lttng-ctl/lttng-ctl-health.c
@@
-3,7
+3,7
@@
*
* Linux Trace Toolkit Health Control Library
*
*
* Linux Trace Toolkit Health Control Library
*
- * Copyright (C) 2011
David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2011
EfficiOS Inc.
* Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
* SPDX-License-Identifier: LGPL-2.1-only
* Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
* SPDX-License-Identifier: LGPL-2.1-only
@@
-15,7
+15,6
@@
#include <sys/types.h>
#include <stdint.h>
#include <limits.h>
#include <sys/types.h>
#include <stdint.h>
#include <limits.h>
-#include <errno.h>
#include <string.h>
#include <lttng/health-internal.h>
#include <string.h>
#include <lttng/health-internal.h>
@@
-24,6
+23,7
@@
#include <bin/lttng-relayd/health-relayd.h>
#include <common/defaults.h>
#include <common/utils.h>
#include <bin/lttng-relayd/health-relayd.h>
#include <common/defaults.h>
#include <common/utils.h>
+#include <common/compat/errno.h>
#include "lttng-ctl-helper.h"
#include "lttng-ctl-helper.h"
@@
-94,7
+94,7
@@
const char **thread_name[NR_HEALTH_COMPONENT] = {
/*
* Set health socket path.
*
/*
* Set health socket path.
*
- * Returns 0 on success or
-ENOMEM
.
+ * Returns 0 on success or
a negative errno
.
*/
static
int set_health_socket_path(struct lttng_health *lh,
*/
static
int set_health_socket_path(struct lttng_health *lh,
@@
-143,10
+143,10
@@
int set_health_socket_path(struct lttng_health *lh,
uid = getuid();
if (uid == 0 || tracing_group) {
uid = getuid();
if (uid == 0 || tracing_group) {
-
lttng_ctl_copy_string
(lh->health_sock_path,
+
ret = lttng_strncpy
(lh->health_sock_path,
global_str,
sizeof(lh->health_sock_path));
global_str,
sizeof(lh->health_sock_path));
- return
0
;
+ return
ret == 0 ? 0 : -EINVAL
;
}
/*
}
/*
@@
-218,20
+218,30
@@
struct lttng_health *
struct lttng_health *lttng_health_create_relayd(const char *path)
{
struct lttng_health *lttng_health_create_relayd(const char *path)
{
- struct lttng_health *lh;
+ int ret;
+ struct lttng_health *lh = NULL;
if (!path) {
if (!path) {
-
return NULL
;
+
goto error
;
}
lh = lttng_health_create(HEALTH_COMPONENT_RELAYD,
NR_HEALTH_RELAYD_TYPES);
if (!lh) {
}
lh = lttng_health_create(HEALTH_COMPONENT_RELAYD,
NR_HEALTH_RELAYD_TYPES);
if (!lh) {
-
return NULL
;
+
goto error
;
}
}
- lttng_ctl_copy_string(lh->health_sock_path, path,
- sizeof(lh->health_sock_path));
+
+ ret = lttng_strncpy(lh->health_sock_path, path,
+ sizeof(lh->health_sock_path));
+ if (ret) {
+ goto error;
+ }
+
return lh;
return lh;
+
+error:
+ free(lh);
+ return NULL;
}
void lttng_health_destroy(struct lttng_health *lh)
}
void lttng_health_destroy(struct lttng_health *lh)
This page took
0.0339 seconds
and
4
git commands to generate.