diff mbox

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

Message ID 1466025487-26743-1-git-send-email-mjeanson@efficios.com
State Accepted, archived
Headers show

Commit Message

Michael Jeanson June 15, 2016, 9:18 p.m. UTC
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 mbox

Patch

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);