aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-02-23 11:36:33 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-02-23 12:25:47 +0200
commit6e73a7b0822d1fd506c75a662070f447bba94afb (patch)
treee121c440aff73316cb43ec05295e2c32492bf5dc
parent584266f8215d913ce0c226f63da51c77d1074f09 (diff)
downloadpies-6e73a7b0822d1fd506c75a662070f447bba94afb.tar.gz
pies-6e73a7b0822d1fd506c75a662070f447bba94afb.tar.bz2
Improve logging
* po/POTFILES.in: Add missing source files. * grecs: Upgrade. * src/diag.c (pies_diag_printer): New function. (logfuncall): New function. * src/pies.h: Add new prototypes. * src/pies.c (main): Initialize grecs_print_diag_fun * src/acl.c: Uniformly use double-quotes in messages. Use logfuncall where applicable. * src/comp.c: Likewise. * src/ctl.c: Likewise. * src/inetd-bi.c: Likewise. * src/inetd.c: Likewise. * src/limits.c: Likewise. * src/piesctl.c: Likewise. * src/progman.c: Likewise. * src/socket.c: Likewise. * src/sysvinit.c: Likewise.
m---------grecs0
-rw-r--r--po/POTFILES.in15
-rw-r--r--src/acl.c22
-rw-r--r--src/comp.c10
-rw-r--r--src/ctl.c5
-rw-r--r--src/diag.c42
-rw-r--r--src/inetd-bi.c3
-rw-r--r--src/inetd.c8
-rw-r--r--src/limits.c7
-rw-r--r--src/pies.c29
-rw-r--r--src/pies.h4
-rw-r--r--src/piesctl.c34
-rw-r--r--src/progman.c21
-rw-r--r--src/socket.c20
-rw-r--r--src/sysvinit.c7
15 files changed, 111 insertions, 116 deletions
diff --git a/grecs b/grecs
Subproject 07838fb2e9ed5769074add028e052a3b667e67e Subproject 8241dc04501f62b613f17f5c165f915a216ba30
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6923cb6..2496b6e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -39 +39,16 @@ lib/netrc.c
39lib/pp.c 39lib/pp.c
40
41grecs/src/cidr.c
42grecs/src/format.c
43grecs/src/grecs-gram.y
44grecs/src/grecs-lex.l
45grecs/src/json-gram.y
46grecs/src/meta1-gram.y
47grecs/src/meta1-lex.l
48grecs/src/opthelp.c
49grecs/src/path-parser.c
50grecs/src/preproc.c
51grecs/src/sockaddr.c
52grecs/src/symtab.c
53grecs/src/tree.c
54grecs/src/wordsplit.c
diff --git a/src/acl.c b/src/acl.c
index 53e5dd8..7b834c9 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -179,3 +179,3 @@ _parse_sockaddr (struct acl_entry *entry, const grecs_value_t *value)
179 grecs_error (&entry->locus, 0, 179 grecs_error (&entry->locus, 0,
180 _("socket name too long: `%s'"), string); 180 _("socket name too long: %s"), string);
181 return 1; 181 return 1;
@@ -202,3 +202,3 @@ _parse_sockaddr (struct acl_entry *entry, const grecs_value_t *value)
202 grecs_error (&entry->locus, 0, 202 grecs_error (&entry->locus, 0,
203 _("cannot resolve host name: `%s'"), string); 203 _("cannot resolve host name: %s"), string);
204 if (p) 204 if (p)
@@ -239,3 +239,3 @@ _parse_sockaddr (struct acl_entry *entry, const grecs_value_t *value)
239 grecs_error (&entry->locus, 0, 239 grecs_error (&entry->locus, 0,
240 _("invalid netmask: `%s'"), p); 240 _("invalid netmask: %s"), p);
241 return 1; 241 return 1;
@@ -246,3 +246,3 @@ _parse_sockaddr (struct acl_entry *entry, const grecs_value_t *value)
246 { 246 {
247 grecs_error (&entry->locus, 0, _("invalid netmask: `%s'"), p); 247 grecs_error (&entry->locus, 0, _("invalid netmask: %s"), p);
248 return 1; 248 return 1;
@@ -283,3 +283,3 @@ _parse_from (struct acl_entry *entry, size_t argc, grecs_value_t **argv)
283 { 283 {
284 grecs_error (&entry->locus, 0, _("expected `from', but found list")); 284 grecs_error (&entry->locus, 0, _("expected \"from\", but found list"));
285 return 1; 285 return 1;
@@ -288,3 +288,3 @@ _parse_from (struct acl_entry *entry, size_t argc, grecs_value_t **argv)
288 { 288 {
289 grecs_error (&entry->locus, 0, _("expected `from', but found `%s'"), 289 grecs_error (&entry->locus, 0, _("expected \"from\", but found \"%s\""),
290 argv[0]->v.string); 290 argv[0]->v.string);
@@ -298,3 +298,3 @@ _parse_from (struct acl_entry *entry, size_t argc, grecs_value_t **argv)
298 grecs_error (&entry->locus, 0, 298 grecs_error (&entry->locus, 0,
299 _("unexpected end of statement after `from'")); 299 _("unexpected end of statement after \"from\""));
300 return 1; 300 return 1;
@@ -323,3 +323,3 @@ _parse_from (struct acl_entry *entry, size_t argc, grecs_value_t **argv)
323 { 323 {
324 grecs_warning (&entry->locus, 0, _("junk after `from' list")); 324 grecs_warning (&entry->locus, 0, _("junk after from-list"));
325 return 1; 325 return 1;
@@ -356,4 +356,4 @@ _parse_sub_acl (struct acl_entry *entry, size_t argc, grecs_value_t **argv)
356 { 356 {
357 grecs_error (&entry->locus, 0, _("ACL not defined: `%s'"), 357 grecs_error (&entry->locus, 0, _("ACL not defined: %s"),
358 argv[0]->v.string); 358 argv[0]->v.string);
359 return 1; 359 return 1;
@@ -434,3 +434,3 @@ parse_acl_line (grecs_locus_t *locus, int allow, pies_acl_t acl,
434 { 434 {
435 grecs_error (&entry->locus, 0, _("unknown word `%s'"), 435 grecs_error (&entry->locus, 0, _("unknown word: %s"),
436 value->v.string); 436 value->v.string);
diff --git a/src/comp.c b/src/comp.c
index 43772c2..7babae7 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -542,3 +542,3 @@ component_verify (struct component *comp, grecs_locus_t *locus)
542 COMPERR (grecs_error, 542 COMPERR (grecs_error,
543 "%s", _("`internal' used without `service'")); 543 "%s", _("\"internal\" used without \"service\""));
544 else 544 else
@@ -554,3 +554,3 @@ component_verify (struct component *comp, grecs_locus_t *locus)
554 COMPERR (grecs_error, 554 COMPERR (grecs_error,
555 "%s", _("`internal' used with `command'")); 555 "%s", _("\"internal\" used with \"command\""));
556 } 556 }
@@ -567,3 +567,3 @@ component_verify (struct component *comp, grecs_locus_t *locus)
567 COMPERR (grecs_error, 567 COMPERR (grecs_error,
568 "%s", _("both `tcpmux' and `tcpmuxplus' used")); 568 "%s", _("both \"tcpmux\" and \"tcpmuxplus\" used"));
569 else if (!comp->service) 569 else if (!comp->service)
@@ -571,3 +571,3 @@ component_verify (struct component *comp, grecs_locus_t *locus)
571 COMPERR (grecs_error, 571 COMPERR (grecs_error,
572 "%s", _("`internal' used without `service'")); 572 "%s", _("\"internal\" used without \"service\""));
573 } 573 }
@@ -662,3 +662,3 @@ component_verify (struct component *comp, grecs_locus_t *locus)
662 COMPERR (grecs_error, 662 COMPERR (grecs_error,
663 "%s", _("stdout translation invalid in this mode")); 663 "%s", _("stdout redirection invalid in this mode"));
664 comp->redir[RETR_OUT].type = redir_null; 664 comp->redir[RETR_OUT].type = redir_null;
diff --git a/src/ctl.c b/src/ctl.c
index 7d44cf1..fd7bfdc 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -1247,3 +1247,3 @@ ctl_accept (int socket, void *data)
1247 { 1247 {
1248 logmsg (LOG_ERR, _("accept failed: %s"), strerror (errno)); 1248 logfuncall ("accept", NULL, errno);
1249 return 1; 1249 return 1;
@@ -1291,4 +1291,3 @@ ctl_open (void)
1291 { 1291 {
1292 logmsg (LOG_CRIT, _("can't listen on control socket %s: %s"), 1292 logfuncall ("listen", control.url->string, errno);
1293 control.url->string, strerror (errno));
1294 return -1; 1293 return -1;
diff --git a/src/diag.c b/src/diag.c
index f601daf..eaf9bed 100644
--- a/src/diag.c
+++ b/src/diag.c
@@ -229,34 +229,12 @@ logmsg_printf (int prio, const char *fmt, ...)
229void 229void
230grecs_print_diag (grecs_locus_t *locus, int err, int errcode, const char *msg) 230pies_diag_printer (grecs_locus_t const *locus, int err, int errcode,
231 const char *msg)
231{ 232{
232 char *locstr = NULL;
233
234 if (locus) 233 if (locus)
235 { 234 {
236 size_t size = 0; 235 char *locstr = NULL;
236 size_t locsize = 0;
237
238 grecs_asprint_locus (&locstr, &locsize, locus);
237 239
238 if (locus->beg.col == 0)
239 grecs_asprintf (&locstr, &size, "%s:%u",
240 locus->beg.file,
241 locus->beg.line);
242 else if (strcmp (locus->beg.file, locus->end.file))
243 grecs_asprintf (&locstr, &size, "%s:%u.%u-%s:%u.%u",
244 locus->beg.file,
245 locus->beg.line, locus->beg.col,
246 locus->end.file,
247 locus->end.line, locus->end.col);
248 else if (locus->beg.line != locus->end.line)
249 grecs_asprintf (&locstr, &size, "%s:%u.%u-%u.%u",
250 locus->beg.file,
251 locus->beg.line, locus->beg.col,
252 locus->end.line, locus->end.col);
253 else
254 grecs_asprintf (&locstr, &size, "%s:%u.%u-%u",
255 locus->beg.file,
256 locus->beg.line, locus->beg.col,
257 locus->end.col);
258 }
259
260 if (locstr)
261 {
262 if (errcode) 240 if (errcode)
@@ -279 +257,9 @@ grecs_print_diag (grecs_locus_t *locus, int err, int errcode, const char *msg)
279 257
258void
259logfuncall (const char *fun, const char *arg, int err)
260{
261 if (arg)
262 grecs_error (NULL, err, _("%s: %s failed"), arg, fun);
263 else
264 grecs_error (NULL, err, _("%s failed"), fun);
265}
diff --git a/src/inetd-bi.c b/src/inetd-bi.c
index 7ce4b39..2032123 100644
--- a/src/inetd-bi.c
+++ b/src/inetd-bi.c
@@ -230,3 +230,4 @@ qotd_read (char *text)
230 { 230 {
231 logmsg (LOG_ERR, _("cannot open %s: %s"), qotdfile, strerror (errno)); 231 logmsg (LOG_ERR, _("cannot open file %s: %s"), qotdfile,
232 strerror (errno));
232 strncpy (text, QOTD_DEF, QOTD_MAX); 233 strncpy (text, QOTD_DEF, QOTD_MAX);
diff --git a/src/inetd.c b/src/inetd.c
index ee16078..40fb6fe 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -357,4 +357,6 @@ inetd_conf_dir (const char *name)
357 { 357 {
358 logmsg (LOG_ERR, _("cannot stat %s/%s: %s"), 358 int ec = errno;
359 name, ent->d_name, strerror (errno)); 359 char *name = mkfilename (name, ent->d_name, NULL);
360 logfuncall ("stat", name, ec);
361 free (name);
360 errs |= 1; 362 errs |= 1;
@@ -385,3 +387,3 @@ inetd_config_parse (const char *file)
385 { 387 {
386 logmsg (LOG_ERR, _("cannot stat %s: %s"), file, strerror (errno)); 388 logfuncall ("stat", file, errno);
387 return 1; 389 return 1;
diff --git a/src/limits.c b/src/limits.c
index 7387b9d..2893ff6 100644
--- a/src/limits.c
+++ b/src/limits.c
@@ -59,4 +59,4 @@ do_set_limit (int rlimit, rlim_t limit)
59 { 59 {
60 logmsg (LOG_NOTICE, _("error setting limit: %s"), 60 //FIXME: arg?
61 strerror (errno)); 61 logfuncall ("setrlimit", NULL, errno);
62 return 1; 62 return 1;
@@ -72,4 +72,3 @@ set_prio (int prio)
72 { 72 {
73 logmsg (LOG_NOTICE, _("error setting priority: %s"), 73 logfuncall ("setpriority", NULL, errno);