aboutsummaryrefslogtreecommitdiff
path: root/src/pies.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-10-15 16:21:32 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-10-15 16:21:32 +0300
commitb713e2208519e7cba1c779cbd9387137eb101e5e (patch)
treec1245c09d9cffa5d74ec8961ed0ffd820f0bd23e /src/pies.c
parent9dbe6b40d07df41255f0c8fda6895000b7c7e1a6 (diff)
downloadpies-b713e2208519e7cba1c779cbd9387137eb101e5e.tar.gz
pies-b713e2208519e7cba1c779cbd9387137eb101e5e.tar.bz2
Various fixes.
* README: Fix typo. * doc/usr-acl.texi: New file. * doc/Makefile.am (pies_TEXINFOS): Remove pies.texi, add usr-acl.texi (check-config, check-sub-config): Handle @deffnx * doc/pies.texi: Update. * src/Makefile.am (AM_CPPFLAGS): Remove superfluous defs, use ../gnu/configmake.h instead * src/acl.c (_acl_common_section_parser): Handle tag, depending on the value of `flag' parameter. Avoid coredumping on NULL pacl. (acl_section_parser, defacl_section_parser): Update calls to _acl_common_section_parser. * src/pies.c (STATEDIR): Replace with LOCALSTATEDIR. (GRECS_VALUE_IS_EMPTY): New define (possibly belongs to grecs more than to pies). (assert_grecs_value_type) (return_code_section_parser): Use GRECS_VALUE_IS_EMPTY to check for empty value. (_get_array_arg): Bugfix. (component_keywords, pies_keywords): Add missing docstrings. * src/progman.c (TYPE_RETR): Rename to TYPE_REDIRECTOR. All uses updated.
Diffstat (limited to 'src/pies.c')
-rw-r--r--src/pies.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/pies.c b/src/pies.c
index d7d4ae1..d4a8013 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -28,9 +28,9 @@ char *log_tag;
struct pies_privs pies_privs;
int foreground;
int command;
-char *pidfile = STATEDIR "/pies.pid";
-char *ctlfile = STATEDIR "/pies.ctl";
-char *statfile = STATEDIR "/pies.stat";
+char *pidfile = LOCALSTATEDIR "/pies.pid";
+char *ctlfile = LOCALSTATEDIR "/pies.ctl";
+char *statfile = LOCALSTATEDIR "/pies.stat";
mode_t pies_umask = 0;
unsigned long shutdown_timeout = 5;
pies_acl_t pies_acl;
@@ -62,11 +62,20 @@ stderr_closed_p ()
}
+#define GRECS_VALUE_IS_EMPTY(val) \
+ (!(val) || ((val)->type == GRECS_TYPE_STRING && !(val)->v.string))
+
int
assert_grecs_value_type (grecs_locus_t * locus,
const grecs_value_t * value, int type)
{
- if (!value || value->type != type)
+ if (GRECS_VALUE_IS_EMPTY (value))
+ {
+ grecs_error (locus, 0, _("expected %s"),
+ grecs_data_type_string (type));
+ return 1;
+ }
+ if (value->type != type)
{
grecs_error (locus, 0, _("expected %s, but found %s"),
grecs_data_type_string (type),
@@ -320,7 +329,8 @@ _get_array_arg (grecs_value_t * val, int num, grecs_locus_t * locus)
{
if (num < val->v.arg.c)
{
- if (assert_grecs_value_type (locus, val, GRECS_TYPE_STRING) == 0)
+ if (assert_grecs_value_type (locus, &val->v.arg.v[num],
+ GRECS_TYPE_STRING) == 0)
return val->v.arg.v[num].v.string;
}
return NULL;
@@ -352,7 +362,7 @@ return_code_section_parser (enum grecs_callback_command cmd,
switch (cmd)
{
case grecs_callback_section_begin:
- if (!value)
+ if (GRECS_VALUE_IS_EMPTY (value))
{
grecs_error (locus, 0, _("missing tag"));
return 1;
@@ -873,7 +883,7 @@ struct grecs_keyword component_keywords[] = {
},
{"return-code",
N_("<tag: exit-code-list>"),
- NULL, /* FIXME: Docstring? */
+ N_("Define what to do when the component finishes."),
grecs_type_section, NULL, 0,
return_code_section_parser, NULL, return_code_keywords},
{NULL}
@@ -1054,8 +1064,10 @@ static struct grecs_keyword syslog_kw[] = {
grecs_type_string, &log_facility, 0, cb_syslog_facility},
{"tag", N_("string"), N_("Tag syslog messages with this string"),
grecs_type_string, &log_tag},
-# if 0
- {"print-priority", N_("arg"), N_("Prefix each message with its priority"),
+#if 0
+ /* This is reserved for future use */
+ {
+ "print-priority", N_("arg"), N_("Prefix each message with its priority"),
grecs_type_bool, &syslog_include_prio},
#endif
{NULL},
@@ -1076,10 +1088,9 @@ _cm_include_meta1 (enum grecs_callback_command cmd,
}
struct grecs_keyword pies_keywords[] = {
- /* FIXME */
{"component",
N_("<tag: string>"),
- NULL, /* FIXME: Docstring */
+ N_("Define a component"),
grecs_type_section, NULL, 0,
component_section_parser, NULL, component_keywords},
{"syslog",
@@ -1121,7 +1132,7 @@ struct grecs_keyword pies_keywords[] = {
{"group",
NULL,
N_("Retain supplementary group."),
- grecs_type_string | GRECS_LIST, /*FIXME*/ &pies_privs.groups, 0,
+ grecs_type_string | GRECS_LIST, &pies_privs.groups, 0,
NULL,
},
{"allgroups",
@@ -1149,13 +1160,13 @@ struct grecs_keyword pies_keywords[] = {
},
{"return-code",
N_("<tag: exit-code-list>"),
- NULL, /* FIXME: Docstring? */
+ N_("Define what to do when the component finishes."),
grecs_type_section, &default_component, 0,
return_code_section_parser, NULL, return_code_keywords},
{"acl",
N_("name: string"),
N_("Set global ACL."),
- grecs_type_section, NULL, 0,
+ grecs_type_section, &pies_acl, 0,
acl_section_parser, NULL, acl_keywords},
{"defacl",
N_("name: string"),
@@ -1170,7 +1181,7 @@ struct grecs_keyword pies_keywords[] = {
},
{"meta1-queue-dir",
NULL,
- N_("Set name of MeTA1 queue directory (default /var/spool/meta1)."),
+ N_("Set the name of MeTA1 queue directory (default /var/spool/meta1)."),
grecs_type_string, &meta1_queue_dir, 0,
NULL,
},
@@ -1586,7 +1597,7 @@ pies_status ()
logmsg (LOG_INFO,
_("pies is not running, but a pidfile "
"is found (pid %lu)"), (unsigned long) pid);
- return 1; /* FIXME: hm? */
+ return 1;
case pies_status_noresp:
logmsg (LOG_INFO,

Return to:

Send suggestions and report system problems to the System administrator.