MCPcopy Create free account
hub / github.com/ElementsProject/lightning / opt_set_mode

Function opt_set_mode

lightningd/options.c:150–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150static char *opt_set_mode(const char *arg, mode_t *m)
151{
152 char *endp;
153 long l;
154
155 assert(arg != NULL);
156
157 /* Ensure length, and starts with 0. */
158 if (strlen(arg) != 4 || arg[0] != '0')
159 return tal_fmt(tmpctx, "'%s' is not a file mode", arg);
160
161 /* strtol, manpage, yech. */
162 errno = 0;
163 l = strtol(arg, &endp, 8); /* Octal. */
164 if (errno || *endp)
165 return tal_fmt(tmpctx, "'%s' is not a file mode", arg);
166 *m = l;
167 /* Range check not needed, previous strlen checks ensures only
168 * 9-bit, which fits mode_t (unless your Unix is seriously borked).
169 */
170
171 return NULL;
172}
173
174static char *opt_force_feerates(const char *arg, struct lightningd *ld)
175{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected