diff --git a/pkg/urbit/include/c/portable.h b/pkg/urbit/include/c/portable.h index eabd1a6248..10c2aa7107 100644 --- a/pkg/urbit/include/c/portable.h +++ b/pkg/urbit/include/c/portable.h @@ -21,6 +21,7 @@ # ifndef _XOPEN_SOURCE # define _XOPEN_SOURCE 700 # endif +# include # include # include # include @@ -38,6 +39,7 @@ # include # elif defined(U3_OS_osx) +# include # include # include # include @@ -58,6 +60,7 @@ # include # elif defined(U3_OS_bsd) +# include # include # include # include @@ -77,6 +80,7 @@ # define signal mingw_has_no_usable_signal # define raise mingw_has_no_usable_raise # define _POSIX +# include # include # include # include diff --git a/pkg/urbit/vere/king.c b/pkg/urbit/vere/king.c index 5ab567b2c6..8170aceaf7 100644 --- a/pkg/urbit/vere/king.c +++ b/pkg/urbit/vere/king.c @@ -321,16 +321,21 @@ _king_get_pace(void) len_w = buf_u.st_size; pat_c = c3_malloc(len_w + 1); red_w = read(fid_i, pat_c, len_w); - pat_c[len_w] = 0; close(fid_i); if ( len_w != red_w ) { c3_free(pat_c); + u3l_log("unable to read pace file, " + "falling back to default (\"live\")\n"); return strdup("live"); } - // XX trim pat_c ? - // + pat_c[len_w] = 0; + + while ( len_w-- && isspace(pat_c[len_w]) ) { + pat_c[len_w] = 0; + } + return pat_c; }