From 5d4142eff88508aed736d51488cc0d856e2c83e8 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Tue, 13 Dec 2022 21:16:30 -0500 Subject: [PATCH] u3: ports minor noun/ cleanup --- pkg/urbit/noun/events.c | 1 + pkg/urbit/noun/manage.c | 4 ++++ pkg/urbit/noun/trace.c | 17 +++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/pkg/urbit/noun/events.c b/pkg/urbit/noun/events.c index 021e65a796..7b1f78b218 100644 --- a/pkg/urbit/noun/events.c +++ b/pkg/urbit/noun/events.c @@ -432,6 +432,7 @@ _ce_patch_verify(u3_ce_patch* pat_u) } return c3n; } + { c3_w nug_w = u3r_mug_words(mem_w, pag_wiz_i); diff --git a/pkg/urbit/noun/manage.c b/pkg/urbit/noun/manage.c index 2852ef797e..02a881d739 100644 --- a/pkg/urbit/noun/manage.c +++ b/pkg/urbit/noun/manage.c @@ -1946,6 +1946,10 @@ void u3m_stop() { u3je_secp_stop(); + + // XX move to jets.c + // + c3_free(u3D.ray_u); } /* u3m_boot(): start the u3 system. return next event, starting from 1. diff --git a/pkg/urbit/noun/trace.c b/pkg/urbit/noun/trace.c index 79d290930d..85afcfd46b 100644 --- a/pkg/urbit/noun/trace.c +++ b/pkg/urbit/noun/trace.c @@ -278,11 +278,19 @@ void u3t_trace_open(c3_c* dir_c) { c3_c fil_c[2048]; + + if ( !dir_c ) { + return; + } + snprintf(fil_c, 2048, "%s/.urb/put/trace", dir_c); struct stat st; - if ( -1 == stat(fil_c, &st) ) { - c3_mkdir(fil_c, 0700); + if ( (-1 == stat(fil_c, &st)) + && (-1 == c3_mkdir(fil_c, 0700)) ) + { + fprintf(stderr, "mkdir: %s failed: %s\r\n", fil_c, strerror(errno)); + return; } c3_c lif_c[2056]; @@ -291,6 +299,11 @@ u3t_trace_open(c3_c* dir_c) u3_Host.tra_u.fil_u = c3_fopen(lif_c, "w"); u3_Host.tra_u.nid_w = (int)getpid(); + if ( !u3_Host.tra_u.fil_u) { + fprintf(stderr, "trace open: %s\r\n", strerror(errno)); + return; + } + fprintf(u3_Host.tra_u.fil_u, "[ "); // We have two "threads", the event processing and the nock stuff.