scpi: Strip trailing newlines in sr_scpi_get_string().

This commit is contained in:
Martin Ling 2014-01-17 13:43:34 +00:00
parent 470140fc0d
commit d03dfac6b9
1 changed files with 4 additions and 0 deletions

View File

@ -312,6 +312,10 @@ SR_PRIV int sr_scpi_get_string(struct sr_scpi_dev_inst *scpi,
g_string_append_len(response, buf, len);
}
/* Get rid of trailing linefeed if present */
if (response->len >= 1 && response->str[response->len - 1] == '\n')
g_string_truncate(response, response->len - 1);
*scpi_response = response->str;
g_string_free(response, FALSE);