Skip to contentSkip to conversation

execute_program() fix in multipath-tools-0.4.4

PATCH New [email protected] 1 participant 1 message Apr 27, 2005 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 execute_program() fix in multipath-tools-0.4.4

Hi Christophe,

If there is no space (' ') in callout strings, the callout isn't called in multipath-tools-0.4.4.

For example, in the default multipath.conf, default_prio_callout is set as "/bin/false". But it's not called due to this bug. If I set it as "/bin/false ", it works.

Regards,
Ky (Kiyoshi Ueda)

libmultipath/callout.c +4 -2
@@ -29,8 +29,8 @@ int execute_program(char *path, char *va
 	int i;
 
 	i = 0;
+	strfieldcpy(arg, path);
 	if (strchr(path, ' ')) {
-		strfieldcpy(arg, path);
 		pos = arg;
 		while (pos != NULL) {
 			if (pos[0] == '\'') {
@@ -39,11 +39,13 @@ int execute_program(char *path, char *va
 				argv[i] = strsep(&pos, "\'");
 				while (pos[0] == ' ')
 					pos++;
-		} else {
+			} else {
 				argv[i] = strsep(&pos, " ");
 			}
 			i++;
 		}
+	} else {
+		argv[i++] = arg;
 	}
 	argv[i] =  NULL;