vty: Fix bad use of vector_slot()

Commit in e9e9e427b7 attempted to fix a
compilation warning but introduced a regression documented in OS#2613.

The commit was reverted in 4aa0258269296f078e685e21fb08b115567e814.

After closer lookup and testing, it seems vector_slot(vline, index) is
expected to be NULL in this case as set by vty_complete_command:
	/* In case of 'help \t'. */
	if (isspace((int)vty->buf[vty->length - 1]))
		vector_set(vline, NULL);

As a result, the correct fix for the compilation warning is to test
against NULL instead of testing for empty string.

Change-Id: Id9e02bbf89e0a94e1766b1efd236538712415c8a
Pau Espin 2017-11-02 19:08:14 +01:00 committed by Neels Hofmeyr
parent c0fc7940df
commit 0f7bcb5f17
1 changed files with 1 additions and 1 deletions

View File

@ -1950,7 +1950,7 @@ static char **cmd_complete_command_real(vector vline, struct vty *vty,
/* In case of 'command \t' pattern. Do you need '?' command at
the end of the line. */
if (vector_slot(vline, index) == '\0')
if (vector_slot(vline, index) == NULL)
*status = CMD_ERR_NO_MATCH;