[PATCH 05/19] messages: add some missing newlines

Ian Jackson ijackson at chiark.greenend.org.uk
Thu Jun 21 04:22:45 BST 2012


Message and cfgfatal must be called with a message containing a
newline (or, a newline sent in a later call).  Fix a few call sites.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 log.c     |    4 ++--
 process.c |    2 +-
 rsa.c     |    8 ++++----
 site.c    |    7 ++++---
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/log.c b/log.c
index 9cd0572..d940df5 100644
--- a/log.c
+++ b/log.c
@@ -170,11 +170,11 @@ void cfgfile_postreadcheck(struct cloc loc, FILE *f)
 {
     assert(loc.file);
     if (ferror(f)) {
-	Message(M_FATAL, "error reading config file (%s): %s",
+	Message(M_FATAL, "error reading config file (%s): %s\n",
 		loc.file, strerror(errno));
 	exit(current_phase);
     } else if (feof(f)) {
-	Message(M_FATAL, "unexpected end of config file (%s)", loc.file);
+	Message(M_FATAL, "unexpected end of config file (%s)\n", loc.file);
 	exit(current_phase);
     }
 }
diff --git a/process.c b/process.c
index 0a7a0f2..a9ff3d9 100644
--- a/process.c
+++ b/process.c
@@ -152,7 +152,7 @@ int sys_cmd(const char *path, const char *arg, ...)
 			path, arg, WTERMSIG(rv), strsignal(WTERMSIG(rv)),
 			WCOREDUMP(rv) ? " - core dumped" : "");
 	    else
-		Message(M_ERR, "sys_cmd(%s,%s,...) exited with wstat %#x",
+		Message(M_ERR, "sys_cmd(%s,%s,...) exited with wstat %#x\n",
 			path, arg, rv);
 	}
     } else if (c==0) {
diff --git a/rsa.c b/rsa.c
index caa030b..0bd106f 100644
--- a/rsa.c
+++ b/rsa.c
@@ -194,7 +194,7 @@ static list_t *rsapub_apply(closure_t *self, struct cloc loc, dict_t *context,
     i=list_elem(args,0);
     if (i) {
 	if (i->type!=t_string) {
-	    cfgfatal(i->loc,"rsa-public","first argument must be a string");
+	    cfgfatal(i->loc,"rsa-public","first argument must be a string\n");
 	}
 	e=i->data.string;
 	if (mpz_init_set_str(&st->e,e,10)!=0) {
@@ -208,7 +208,7 @@ static list_t *rsapub_apply(closure_t *self, struct cloc loc, dict_t *context,
     i=list_elem(args,1);
     if (i) {
 	if (i->type!=t_string) {
-	    cfgfatal(i->loc,"rsa-public","second argument must be a string");
+	    cfgfatal(i->loc,"rsa-public","second argument must be a string\n");
 	}
 	n=i->data.string;
 	if (mpz_init_set_str(&st->n,n,10)!=0) {
@@ -267,7 +267,7 @@ static list_t *rsapriv_apply(closure_t *self, struct cloc loc, dict_t *context,
     i=list_elem(args,0);
     if (i) {
 	if (i->type!=t_string) {
-	    cfgfatal(i->loc,"rsa-public","first argument must be a string");
+	    cfgfatal(i->loc,"rsa-public","first argument must be a string\n");
 	}
 	filename=i->data.string;
     } else {
@@ -313,7 +313,7 @@ static list_t *rsapriv_apply(closure_t *self, struct cloc loc, dict_t *context,
     }
     b=safe_malloc(length,"rsapriv_apply");
     if (fread(b,length,1,f) != 1) {
-	cfgfatal_maybefile(f,loc,"rsa-private","error reading modulus");
+	cfgfatal_maybefile(f,loc,"rsa-private","error reading modulus\n");
     }
     mpz_init(&st->n);
     read_mpbin(&st->n,b,length);
diff --git a/site.c b/site.c
index 0cd364b..b54b34e 100644
--- a/site.c
+++ b/site.c
@@ -1342,15 +1342,16 @@ static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context,
     st->netlink=find_cl_if(dict,"link",CL_NETLINK,True,"site",loc);
 
     list_t *comms_cfg=dict_lookup(dict,"comm");
-    if (!comms_cfg) cfgfatal(loc,"site","closure list \"comm\" not found");
+    if (!comms_cfg) cfgfatal(loc,"site","closure list \"comm\" not found\n");
     st->ncomms=list_length(comms_cfg);
     st->comms=safe_malloc_ary(sizeof(*st->comms),st->ncomms,"comms");
     assert(st->ncomms);
     for (i=0; i<st->ncomms; i++) {
 	item_t *item=list_elem(comms_cfg,i);
-	if (item->type!=t_closure) cfgfatal(loc,"site","comm is not a closure");
+	if (item->type!=t_closure)
+	    cfgfatal(loc,"site","comm is not a closure\n");
 	closure_t *cl=item->data.closure;
-	if (cl->type!=CL_COMM) cfgfatal(loc,"site","comm closure wrong type");
+	if (cl->type!=CL_COMM) cfgfatal(loc,"site","comm closure wrong type\n");
 	st->comms[i]=cl->interface;
     }
 
-- 
1.7.2.5




More information about the sgo-software-discuss mailing list