From: Jonathan Rajotte Date: Thu, 9 Jun 2016 15:15:59 +0000 (-0400) Subject: Fix format and variable name create.c X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=b37959c76a4420e32cb7df9dacb60f7f64f72e49 Fix format and variable name create.c --- diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c index 7581624ad..caa12d93e 100644 --- a/src/bin/lttng/commands/create.c +++ b/src/bin/lttng/commands/create.c @@ -459,7 +459,7 @@ static int parse_template (struct config_document *template, char **shm_path) { int ret = 0; - int printed_byte; + int printed_bytes; char *raw_value = NULL; assert(template); @@ -496,8 +496,8 @@ static int parse_template (struct config_document *template, if (strlen(raw_value) > 0) { *output_type = OUTPUT_LOCAL; - printed_byte = asprintf(url, "file://%s", raw_value); - if (printed_byte < 0) { + printed_bytes = asprintf(url, "file://%s", raw_value); + if (printed_bytes < 0) { ret = -1; goto error; } @@ -533,8 +533,8 @@ static int parse_template (struct config_document *template, if (strlen(raw_value) > 0) { *output_type = OUTPUT_LOCAL; - printed_byte = asprintf(url, "file://%s", raw_value); - if (printed_byte < 0) { + printed_bytes = asprintf(url, "file://%s", raw_value); + if (printed_bytes < 0) { ret = -1; goto error; } @@ -583,7 +583,7 @@ static int create_session_from_template(struct config_document *template, const char *datetime) { int ret = CMD_SUCCESS; - int printed_byte; + int printed_bytes; struct config_element *temp_element = NULL; struct config_element *temp_element_child = NULL; char tmp_ctrl_uri[PATH_MAX]; @@ -624,8 +624,8 @@ static int create_session_from_template(struct config_document *template, */ if (session_type == SESSION_LIVE) { if (config_document_element_exist(template, "/sessions/session/attributes/live_timer_interval")) { - printed_byte = asprintf(&tmp_string, "%d", live_timer); - if (printed_byte < 0) { + printed_bytes = asprintf(&tmp_string, "%d", live_timer); + if (printed_bytes < 0) { ERR("Asprintf failed for live timer"); ret = CMD_ERROR; goto error; @@ -932,7 +932,7 @@ error: static int create_session(void) { int ret; - int printed_byte; + int printed_bytes; /* Template */ @@ -1046,24 +1046,24 @@ static int create_session(void) goto error; } - printed_byte = asprintf(&session_name_date, "%s-%s", base_session_name, datetime); - if (printed_byte < 0) { + printed_bytes = asprintf(&session_name_date, "%s-%s", base_session_name, datetime); + if (printed_bytes < 0) { PERROR("Asprintf session name"); ret = CMD_ERROR; goto error; } DBG("Session name from command option set to %s", base_session_name); } else if (base_session_name) { - printed_byte = asprintf(&session_name_date, "%s-%s", base_session_name, datetime); - if (printed_byte < 0) { + printed_bytes = asprintf(&session_name_date, "%s-%s", base_session_name, datetime); + if (printed_bytes < 0) { PERROR("Asprintf session name"); ret = CMD_ERROR; goto error; } } else { /* Generate a name */ - printed_byte = asprintf(&base_session_name, DEFAULT_SESSION_NAME "-%s", datetime); - if (printed_byte < 0) { + printed_bytes = asprintf(&base_session_name, DEFAULT_SESSION_NAME "-%s", datetime); + if (printed_bytes < 0) { PERROR("Asprintf session name"); ret = CMD_ERROR; goto error; @@ -1099,8 +1099,8 @@ static int create_session(void) } /* Create URL string from the local file system path */ - printed_byte = asprintf(&temp_url, "file://%s", traces_path); - if (printed_byte < 0) { + printed_bytes = asprintf(&temp_url, "file://%s", traces_path); + if (printed_bytes < 0) { PERROR("asprintf url path"); ret = CMD_FATAL; goto error; @@ -1132,11 +1132,11 @@ static int create_session(void) goto error; } - printed_byte = asprintf(&tmp_url, + printed_bytes = asprintf(&tmp_url, "file://%s/" DEFAULT_TRACE_DIR_NAME "/%s", tmp_home_path, session_name_date); - if (printed_byte < 0) { + if (printed_bytes < 0) { PERROR("asprintf trace dir name"); ret = CMD_FATAL; goto error; @@ -1146,8 +1146,8 @@ static int create_session(void) break; case SESSION_LIVE: /* Default to a net output */ - printed_byte = asprintf(&tmp_url, "net://127.0.0.1"); - if (printed_byte < 0) { + printed_bytes = asprintf(&tmp_url, "net://127.0.0.1"); + if (printed_bytes < 0) { PERROR("asprintf default live URL"); ret = CMD_FATAL; goto error; @@ -1167,8 +1167,8 @@ static int create_session(void) if (opt_shm_path) { /* Overwrite shm_path so clear any previously defined one */ free(base_shm_path); - printed_byte = asprintf(&base_shm_path, "%s/%s", opt_shm_path, session_name_date); - if (printed_byte < 0) { + printed_bytes = asprintf(&base_shm_path, "%s/%s", opt_shm_path, session_name_date); + if (printed_bytes < 0) { PERROR("asprintf shm_path"); ret = CMD_FATAL; goto error; @@ -1183,6 +1183,7 @@ static int create_session(void) } /* Get output type from urls */ + /* TODO: Find a better way of inferring output type */ if (base_url) { /* Get lttng uris from single url */ uri_array_size = uri_parse_str_urls(base_url, NULL, &uris); @@ -1228,7 +1229,7 @@ static int create_session(void) base_shm_path, datetime); } else { - ret = create_session_basic (base_session_name, + ret = create_session_basic(base_session_name, base_session_type, base_live_timer, base_output_type, @@ -1242,7 +1243,7 @@ static int create_session(void) goto error; } - ret = generate_output (base_session_name, + ret = generate_output(base_session_name, base_session_type, base_live_timer, base_output_type,