summaryrefslogtreecommitdiff
path: root/snac.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-09-26 11:19:45 +0200
committerdefault <nobody@localhost>2022-09-26 11:19:45 +0200
commitfd6f71bfe36331d046e4183c2c133c6f01c9af2d (patch)
tree2523108550567f4f20d0b3e3d8ec703f09a05c4d /snac.c
parentacc467c0346535f9f71b62bf68cbfbea7d1db0ee (diff)
More work but signatures seem to still fail.
Diffstat (limited to 'snac.c')
-rw-r--r--snac.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/snac.c b/snac.c
index 52ac7d3..2c350bb 100644
--- a/snac.c
+++ b/snac.c
@@ -142,7 +142,7 @@ void srv_archive(char *direction, char *req, char *payload, int p_size,
/* archives a connection */
{
/* obsessive archiving */
- xs *date = xs_local_time("%Y%m%d%H%M%S");
+ xs *date = tid(0);
xs *dir = xs_fmt("%s/archive/%s", srv_basedir, date);
FILE *f;
@@ -172,7 +172,10 @@ void srv_archive(char *direction, char *req, char *payload, int p_size,
if ((f = fopen(payload_fn, "w")) != NULL) {
xs *v1 = xs_json_loads(payload);
- xs *j1 = xs_json_dumps_pp(v1, 4);
+ xs *j1 = NULL;
+
+ if (v1 != NULL)
+ j1 = xs_json_dumps_pp(v1, 4);
if (j1 != NULL)
fwrite(j1, strlen(j1), 1, f);
@@ -200,7 +203,10 @@ void srv_archive(char *direction, char *req, char *payload, int p_size,
if ((f = fopen(body_fn, "w")) != NULL) {
xs *v1 = xs_json_loads(body);
- xs *j1 = xs_json_dumps_pp(v1, 4);
+ xs *j1 = NULL;
+
+ if (v1 != NULL)
+ j1 = xs_json_dumps_pp(v1, 4);
if (j1 != NULL)
fwrite(j1, strlen(j1), 1, f);