| 148 | } |
| 149 | |
| 150 | static 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 | |
| 174 | static char *opt_force_feerates(const char *arg, struct lightningd *ld) |
| 175 | { |
nothing calls this directly
no outgoing calls
no test coverage detected