aboutsummaryrefslogtreecommitdiff
path: root/src/pies.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pies.c')
-rw-r--r--src/pies.c41
1 files changed, 26 insertions, 15 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}
@@ -1055,7 +1065,9 @@ static struct grecs_keyword syslog_kw[] = {
{"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"),
+ /* 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.