projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean-up: sessiond: silence negative index warning
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
action-executor.c
diff --git
a/src/bin/lttng-sessiond/action-executor.c
b/src/bin/lttng-sessiond/action-executor.c
index 2e6e27a8ce3febcfd0db7cbb100369ff7d974ca4..db16f8049c19846ba3e3dfd3538551b29d68aaf3 100644
(file)
--- a/
src/bin/lttng-sessiond/action-executor.c
+++ b/
src/bin/lttng-sessiond/action-executor.c
@@
-104,7
+104,11
@@
static const char *action_type_names[] = {
static const char *get_action_name(const struct lttng_action *action)
{
static const char *get_action_name(const struct lttng_action *action)
{
- return action_type_names[lttng_action_get_type_const(action)];
+ const enum lttng_action_type action_type = lttng_action_get_type(action);
+
+ assert(action_type != LTTNG_ACTION_TYPE_UNKNOWN);
+
+ return action_type_names[action_type];
}
/* Check if this trigger allowed to interect with a given session. */
}
/* Check if this trigger allowed to interect with a given session. */
@@
-113,22
+117,21
@@
static bool is_trigger_allowed_for_session(const struct lttng_trigger *trigger,
{
bool is_allowed = false;
const struct lttng_credentials session_creds = {
{
bool is_allowed = false;
const struct lttng_credentials session_creds = {
- .uid =
session->uid
,
- .gid =
session->gid
,
+ .uid =
LTTNG_OPTIONAL_INIT_VALUE(session->uid)
,
+ .gid =
LTTNG_OPTIONAL_INIT_VALUE(session->gid)
,
};
/* Can never be NULL. */
const struct lttng_credentials *trigger_creds =
lttng_trigger_get_credentials(trigger);
};
/* Can never be NULL. */
const struct lttng_credentials *trigger_creds =
lttng_trigger_get_credentials(trigger);
- is_allowed = (
trigger_creds->uid == session_creds.uid
) ||
- (
trigger_creds->uid
== 0);
+ is_allowed = (
lttng_credentials_is_equal_uid(trigger_creds, &session_creds)
) ||
+ (
lttng_credentials_get_uid(trigger_creds)
== 0);
if (!is_allowed) {
if (!is_allowed) {
- WARN("Trigger is not allowed to interact with session `%s`: session uid = %ld, session gid = %ld, trigger uid = %ld
, trigger gid = %ld
",
+ WARN("Trigger is not allowed to interact with session `%s`: session uid = %ld, session gid = %ld, trigger uid = %ld",
session->name,
(long int) session->uid,
(long int) session->gid,
session->name,
(long int) session->uid,
(long int) session->gid,
- (long int) trigger_creds->uid,
- (long int) trigger_creds->gid);
+ (long int) lttng_credentials_get_uid(trigger_creds));
}
return is_allowed;
}
return is_allowed;
@@
-481,12
+484,16
@@
static int action_executor_generic_handler(struct action_executor *executor,
const struct action_work_item *work_item,
const struct lttng_action *action)
{
const struct action_work_item *work_item,
const struct lttng_action *action)
{
+ const enum lttng_action_type action_type = lttng_action_get_type(action);
+
+ assert(action_type != LTTNG_ACTION_TYPE_UNKNOWN);
+
DBG("Executing action `%s` of trigger `%p` action work item %" PRIu64,
get_action_name(action),
work_item->trigger,
work_item->id);
DBG("Executing action `%s` of trigger `%p` action work item %" PRIu64,
get_action_name(action),
work_item->trigger,
work_item->id);
- return action_executors[
lttng_action_get_type_const(action)
](
+ return action_executors[
action_type
](
executor, work_item, action);
}
executor, work_item, action);
}
This page took
0.023662 seconds
and
4
git commands to generate.