From 46bdd4badb09a66ba3fc4247f9edb32029d44583 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 22 Aug 2017 14:34:03 +0930 Subject: [PATCH] check-bolt: allow references to BOLT #0. Signed-off-by: Rusty Russell --- check-bolt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/check-bolt.c b/check-bolt.c index c71d820a9..176f4da6d 100644 --- a/check-bolt.c +++ b/check-bolt.c @@ -237,14 +237,15 @@ static struct bolt_file *find_bolt(const char *bolt_prefix, { size_t i, n = tal_count(bolts); int boltnum; + char *endp; for (i = 0; i < n; i++) if (streq(bolts[i].prefix, bolt_prefix)) return bolts+i; /* Now search for numerical match. */ - boltnum = atoi(bolt_prefix); - if (boltnum) { + boltnum = strtol(bolt_prefix, &endp, 10); + if (endp != bolt_prefix && *endp == 0) { for (i = 0; i < n; i++) if (atoi(bolts[i].prefix) == boltnum) return bolts+i;