changeset 4559:c9da6ac27892 draft

options: Fix a static analysis error Can't actually happen because the string doesn't change and the result is already checked above. However, it's pretty harmless to add.
author Roy Marples <roy@marples.name>
date Mon, 22 Jul 2019 11:49:54 +0100
parents a4d9b0152582
children 9745c72fc2eb
files src/if-options.c
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-options.c	Mon Jul 22 11:38:10 2019 +0100
+++ b/src/if-options.c	Mon Jul 22 11:49:54 2019 +0100
@@ -719,9 +719,6 @@
 		if (s == 0) {
 			ifo->script = NULL;
 			break;
-		} else if (s == -1) {
-			logerr("%s: script", __func__);
-			return -1;
 		}
 		dl = (size_t)s;
 		if (s == -1 || (ifo->script = malloc(dl)) == NULL) {
@@ -729,8 +726,9 @@
 			logerr(__func__);
 			return -1;
 		}
-		parse_str(ifo->script, dl, arg, PARSE_STRING_NULL);
-		if (ifo->script[0] == '\0' ||
+		s = parse_str(ifo->script, dl, arg, PARSE_STRING_NULL);
+		if (s == -1 ||
+		    ifo->script[0] == '\0' ||
 		    strcmp(ifo->script, "/dev/null") == 0)
 		{
 			free(ifo->script);