64
64
sigprocmask(), SIG_BLOCK, SIGCHLD,
65
65
SIG_UNBLOCK, kill() */
66
66
#include <errno.h> /* errno, EBADF */
67
#include <inttypes.h> /* intmax_t, SCNdMAX, PRIdMAX, */
68
69
#define BUFFER_SIZE 256
463
465
/* This is already done by parse_opt_config_file() */
465
467
case 130: /* --userid */
466
/* In the GNU C library, uid_t is always unsigned int */
467
ret = sscanf(arg, "%u", &uid);
469
fprintf(stderr, "Bad user ID number: \"%s\", using %u\n", arg,
468
ret = sscanf(arg, "%" SCNdMAX "%n", &tmpmax, &numchars);
469
if(ret < 1 or tmpmax != (uid_t)tmpmax
470
or arg[numchars] != '\0'){
471
fprintf(stderr, "Bad user ID number: \"%s\", using %"
472
PRIdMAX "\n", arg, (intmax_t)uid);
473
477
case 131: /* --groupid */
474
/* In the GNU C library, gid_t is always unsigned int */
475
ret = sscanf(arg, "%u", &gid);
477
fprintf(stderr, "Bad group ID number: \"%s\", using %u\n",
478
ret = sscanf(arg, "%" SCNdMAX "%n", &tmpmax, &numchars);
479
if(ret < 1 or tmpmax != (gid_t)tmpmax
480
or arg[numchars] != '\0'){
481
fprintf(stderr, "Bad group ID number: \"%s\", using %"
482
PRIdMAX "\n", arg, (intmax_t)gid);
481
487
case 132: /* --debug */
647
653
for(char **a = p->argv; *a != NULL; a++){
648
654
fprintf(stderr, "\tArg: %s\n", *a);
650
fprintf(stderr, "...and %u environment variables\n", p->envc);
656
fprintf(stderr, "...and %d environment variables\n", p->envc);
651
657
for(char **a = p->environ; *a != NULL; a++){
652
658
fprintf(stderr, "\t%s\n", *a);
962
968
if(WIFEXITED(proc->status)){
963
fprintf(stderr, "Plugin %u exited with status %d\n",
964
(unsigned int) (proc->pid),
969
fprintf(stderr, "Plugin %" PRIdMAX " exited with status"
970
" %d\n", (intmax_t) (proc->pid),
965
971
WEXITSTATUS(proc->status));
966
972
} else if(WIFSIGNALED(proc->status)) {
967
fprintf(stderr, "Plugin %u killed by signal %d\n",
968
(unsigned int) (proc->pid),
973
fprintf(stderr, "Plugin %" PRIdMAX " killed by signal"
974
" %d\n", (intmax_t) (proc->pid),
969
975
WTERMSIG(proc->status));
970
976
} else if(WCOREDUMP(proc->status)){
971
fprintf(stderr, "Plugin %u dumped core\n",
972
(unsigned int) (proc->pid));
977
fprintf(stderr, "Plugin %" PRIdMAX " dumped core\n",
978
(intmax_t) (proc->pid));