Fix: snapshot del-output with name on musl
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 15 Jun 2016 21:18:02 +0000 (17:18 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 28 Jun 2016 19:44:22 +0000 (15:44 -0400)
Some implementations of strtol(), like the one in musl, will
return EINVAL in errno when no valid number was found in
the string.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/snapshot.c

index d948226ae9770591c32dc3599151b8f6e1b6b81f..00aa5b790448e57d3a26d1b8f838bd51d6acf564 100644 (file)
@@ -350,7 +350,7 @@ static int cmd_del_output(int argc, const char **argv)
 
        errno = 0;
        id = strtol(argv[1], &name, 10);
 
        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);
                ret = del_output(UINT32_MAX, name);
        } else if (errno == 0 && *name == '\0') {
                ret = del_output(id, NULL);
This page took 0.026792 seconds and 5 git commands to generate.