hsm_secret: fixup! make read_line tidier

This commit is contained in:
Sangbida Chaudhuri
2025-10-24 13:57:51 +10:30
committed by Rusty Russell
parent a289cd4ff5
commit b676171f86

View File

@@ -415,8 +415,8 @@ static char *read_line(const tal_t *ctx)
/* Strip newline */
size_t len = strlen(line);
if (len > 0 && line[len - 1] == '\n')
line[len - 1] = '\0';
if (strends(line, "\n"))
len--;
/* Convert to tal string */
char *result = tal_strndup(ctx, line, len);