mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-01 19:46:36 +03:00
vere: trim trailing whitespace from pace file
This commit is contained in:
parent
95eda1e8ab
commit
dbc61c360b
@ -2,6 +2,7 @@
|
||||
**
|
||||
** the main loop of the daemon process
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include "all.h"
|
||||
#include "ur/ur.h"
|
||||
#include "vere/ivory.h"
|
||||
@ -321,16 +322,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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user