[MERGED] libosmocore[master]: vty: Fix bad use of vector_slot()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Nov 10 16:45:03 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: vty: Fix bad use of vector_slot()
......................................................................


vty: Fix bad use of vector_slot()

Commit in e9e9e427b78271941a25a63567fc2ec2bb9e4433 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
---
M src/vty/command.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/vty/command.c b/src/vty/command.c
index 21b26b4..98d86d2 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -1950,7 +1950,7 @@
 
 		/* 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_NOTHING_TODO;
 		else
 			*status = CMD_ERR_NO_MATCH;

-- 
To view, visit https://gerrit.osmocom.org/4672
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id9e02bbf89e0a94e1766b1efd236538712415c8a
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list