diff options
Diffstat (limited to 'snac.c')
| -rw-r--r-- | snac.c | 12 |
1 files changed, 9 insertions, 3 deletions
| @@ -142,7 +142,7 @@ void srv_archive(char *direction, char *req, char *payload, int p_size, | |||
| 142 | /* archives a connection */ | 142 | /* archives a connection */ |
| 143 | { | 143 | { |
| 144 | /* obsessive archiving */ | 144 | /* obsessive archiving */ |
| 145 | xs *date = xs_local_time("%Y%m%d%H%M%S"); | 145 | xs *date = tid(0); |
| 146 | xs *dir = xs_fmt("%s/archive/%s", srv_basedir, date); | 146 | xs *dir = xs_fmt("%s/archive/%s", srv_basedir, date); |
| 147 | FILE *f; | 147 | FILE *f; |
| 148 | 148 | ||
| @@ -172,7 +172,10 @@ void srv_archive(char *direction, char *req, char *payload, int p_size, | |||
| 172 | 172 | ||
| 173 | if ((f = fopen(payload_fn, "w")) != NULL) { | 173 | if ((f = fopen(payload_fn, "w")) != NULL) { |
| 174 | xs *v1 = xs_json_loads(payload); | 174 | xs *v1 = xs_json_loads(payload); |
| 175 | xs *j1 = xs_json_dumps_pp(v1, 4); | 175 | xs *j1 = NULL; |
| 176 | |||
| 177 | if (v1 != NULL) | ||
| 178 | j1 = xs_json_dumps_pp(v1, 4); | ||
| 176 | 179 | ||
| 177 | if (j1 != NULL) | 180 | if (j1 != NULL) |
| 178 | fwrite(j1, strlen(j1), 1, f); | 181 | fwrite(j1, strlen(j1), 1, f); |
| @@ -200,7 +203,10 @@ void srv_archive(char *direction, char *req, char *payload, int p_size, | |||
| 200 | 203 | ||
| 201 | if ((f = fopen(body_fn, "w")) != NULL) { | 204 | if ((f = fopen(body_fn, "w")) != NULL) { |
| 202 | xs *v1 = xs_json_loads(body); | 205 | xs *v1 = xs_json_loads(body); |
| 203 | xs *j1 = xs_json_dumps_pp(v1, 4); | 206 | xs *j1 = NULL; |
| 207 | |||
| 208 | if (v1 != NULL) | ||
| 209 | j1 = xs_json_dumps_pp(v1, 4); | ||
| 204 | 210 | ||
| 205 | if (j1 != NULL) | 211 | if (j1 != NULL) |
| 206 | fwrite(j1, strlen(j1), 1, f); | 212 | fwrite(j1, strlen(j1), 1, f); |