| 214 | } |
| 215 | |
| 216 | int tmpdir_mkstemp(const tal_t *ctx, const char *template TAKES, char **created) |
| 217 | { |
| 218 | char *tmpdir = getenv("TMPDIR"); |
| 219 | char *path = path_join(ctx, tmpdir ?: "/tmp", template); |
| 220 | int fd = mkstemp(path); |
| 221 | |
| 222 | if (fd >= 0) |
| 223 | *created = path; |
| 224 | else |
| 225 | tal_free(path); |
| 226 | |
| 227 | return fd; |
| 228 | } |
| 229 | |
| 230 | char *str_lowering(const void *ctx, const char *string TAKES) |
| 231 | { |