[lttng-dev] [PATCH lttng-tools 1/6] Fix: snapshot del-output with name on musl

Michael Jeanson mjeanson at efficios.com
Wed Jun 15 21:18:02 UTC 2016


Some implementations of strtol() like the one in musl will
return EINVAL in perror when no valid number was found in
the string.

Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
 src/bin/lttng/commands/snapshot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/lttng/commands/snapshot.c b/src/bin/lttng/commands/snapshot.c
index d948226..00aa5b7 100644
--- a/src/bin/lttng/commands/snapshot.c
+++ b/src/bin/lttng/commands/snapshot.c
@@ -350,7 +350,7 @@ static int cmd_del_output(int argc, const char **argv)
 
 	errno = 0;
 	id = strtol(argv[1], &name, 10);
-	if (id == 0 && errno == 0) {
+	if (id == 0 && (errno == 0 || errno == EINVAL)) {
 		ret = del_output(UINT32_MAX, name);
 	} else if (errno == 0 && *name == '\0') {
 		ret = del_output(id, NULL);
-- 
2.7.4



More information about the lttng-dev mailing list