From: Jérémie Galarneau Date: Tue, 10 Sep 2019 23:35:32 +0000 (-0400) Subject: Clean-up: remove NULL check on sesison_create mandatory arguments X-Git-Tag: v2.11.0-rc4~69 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7e0a8f85d65b2df39e1b8455bd88c2e5da995956;p=lttng-tools.git Clean-up: remove NULL check on sesison_create mandatory arguments session_name, base_path, and hostname are assumed to be non-null in the session_create() function. Checking the pointers for null is therefore useless. Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/session.c b/src/bin/lttng-relayd/session.c index 827746430..2f65848a9 100644 --- a/src/bin/lttng-relayd/session.c +++ b/src/bin/lttng-relayd/session.c @@ -181,17 +181,21 @@ struct relay_session *session_create(const char *session_name, int ret; struct relay_session *session = NULL; - if (session_name && strstr(session_name, ".")) { + assert(session_name); + assert(hostname); + assert(base_path); + + if (strstr(session_name, ".")) { ERR("Illegal character in session name: \"%s\"", session_name); goto error; } - if (base_path && strstr(base_path, "../")) { + if (strstr(base_path, "../")) { ERR("Invalid session base path walks up the path hierarchy: \"%s\"", base_path); goto error; } - if (hostname && strstr(hostname, ".")) { + if (strstr(hostname, ".")) { ERR("Invalid character in hostname: \"%s\"", hostname); goto error;