Skip to content

Commit 31cee25

Browse files
committed
hsm_secret: fixup! make read_line tidier
1 parent dda3195 commit 31cee25

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

common/hsm_secret.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ static char *read_line(const tal_t *ctx)
401401

402402
/* Strip newline */
403403
size_t len = strlen(line);
404-
if (len > 0 && line[len - 1] == '\n')
405-
line[len - 1] = '\0';
404+
if (strends(line, "\n"))
405+
len--;
406406

407407
/* Convert to tal string */
408408
char *result = tal_strndup(ctx, line, len);
@@ -426,7 +426,7 @@ const char *read_stdin_pass(const tal_t *ctx, enum hsm_secret_error *err)
426426
*err = HSM_SECRET_ERR_INVALID_FORMAT;
427427
return NULL;
428428
}
429-
429+
430430
mlock_tal_memory(input);
431431

432432
if (echo_disabled)

wallet/test/run-chain_moves_duplicate-detect.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ static void db_log_(struct logger *log UNUSED, enum log_level level UNUSED, cons
2828
/* Generated stub for bip32_pubkey */
2929
void bip32_pubkey(struct lightningd *ld UNNEEDED, struct pubkey *pubkey UNNEEDED, u32 index UNNEEDED)
3030
{ fprintf(stderr, "bip32_pubkey called!\n"); abort(); }
31+
/* Generated stub for bip86_pubkey */
32+
void bip86_pubkey(struct lightningd *ld UNNEEDED, struct pubkey *pubkey UNNEEDED, u32 index UNNEEDED)
33+
{ fprintf(stderr, "bip86_pubkey called!\n"); abort(); }
3134
/* Generated stub for bitcoind_getrawblockbyheight_ */
3235
void bitcoind_getrawblockbyheight_(const tal_t *ctx UNNEEDED,
3336
struct bitcoind *bitcoind UNNEEDED,

wallet/test/run-migrate_remove_chain_moves_duplicates.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ static void db_log_(struct logger *log UNUSED, enum log_level level UNUSED, cons
2929
/* Generated stub for bip32_pubkey */
3030
void bip32_pubkey(struct lightningd *ld UNNEEDED, struct pubkey *pubkey UNNEEDED, u32 index UNNEEDED)
3131
{ fprintf(stderr, "bip32_pubkey called!\n"); abort(); }
32+
/* Generated stub for bip86_pubkey */
33+
void bip86_pubkey(struct lightningd *ld UNNEEDED, struct pubkey *pubkey UNNEEDED, u32 index UNNEEDED)
34+
{ fprintf(stderr, "bip86_pubkey called!\n"); abort(); }
3235
/* Generated stub for bitcoind_getrawblockbyheight_ */
3336
void bitcoind_getrawblockbyheight_(const tal_t *ctx UNNEEDED,
3437
struct bitcoind *bitcoind UNNEEDED,

0 commit comments

Comments
 (0)