Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion common/amount.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ WARN_UNUSED_RESULT bool amount_msat_scale(struct amount_msat *val,
{
double scaled = sat.millisatoshis * scale;

if (scaled > UINT64_MAX)
/* If mantissa is < 64 bits, a naive "if (scaled >
* UINT64_MAX)" doesn't work. Stick to powers of 2. */
if (scaled >= (double)((u64)1 << 63) * 2)
return false;
val->millisatoshis = scaled;
return true;
Expand Down
8 changes: 4 additions & 4 deletions lightningd/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ void plugins_add_default_dir(struct plugins *plugins)
const char *plugin_send_getmanifest(struct plugin *p)
{
char **cmd;
int stdin, stdout;
int stdinfd, stdoutfd;
struct jsonrpc_request *req;
bool debug = false;

Expand All @@ -1308,7 +1308,7 @@ const char *plugin_send_getmanifest(struct plugin *p)
cmd[0] = p->cmd;
if (debug)
cmd[1] = "--debugger";
p->pid = pipecmdarr(&stdin, &stdout, &pipecmd_preserve, cmd);
p->pid = pipecmdarr(&stdinfd, &stdoutfd, &pipecmd_preserve, cmd);
if (p->pid == -1)
return tal_fmt(p, "opening pipe: %s", strerror(errno));

Expand All @@ -1319,8 +1319,8 @@ const char *plugin_send_getmanifest(struct plugin *p)

/* Create two connections, one read-only on top of p->stdout, and one
* write-only on p->stdin */
p->stdout_conn = io_new_conn(p, stdout, plugin_stdout_conn_init, p);
p->stdin_conn = io_new_conn(p, stdin, plugin_stdin_conn_init, p);
p->stdout_conn = io_new_conn(p, stdoutfd, plugin_stdout_conn_init, p);
p->stdin_conn = io_new_conn(p, stdinfd, plugin_stdin_conn_init, p);
req = jsonrpc_request_start(p, "getmanifest", p->log,
plugin_manifest_cb, p);
/* Adding allow-deprecated-apis is part of the deprecation cycle! */
Expand Down