/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-client.c

  • Committer: Teddy Hogeborn
  • Date: 2008-08-10 16:13:23 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080810161323-wrh1rbpdrq0otuhf
* mandos (console): Define handler globally.
  (main): If in debug mode, also reduce consol log level.  Remove
          console log handler before daemonizing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
 
67
67
#define BUFFER_SIZE 256
68
68
 
 
69
const char *argp_program_version = "mandos-client 1.0";
 
70
const char *argp_program_bug_address = "<mandos@fukt.bsnet.se>";
 
71
 
69
72
struct process;
70
73
 
71
74
typedef struct process{
144
147
  return fcntl(fd, F_SETFD, ret | FD_CLOEXEC);
145
148
}
146
149
 
147
 
const char *argp_program_version = "plugbasedclient 0.9";
148
 
const char *argp_program_bug_address = "<mandos@fukt.bsnet.se>";
149
 
 
150
150
process *process_list = NULL;
151
151
 
152
152
/* Mark a process as completed when it exits, and save its exit
292
292
  
293
293
  ret = argp_parse (&argp, argc, argv, 0, 0, &plugin_list);
294
294
  if (ret == ARGP_ERR_UNKNOWN){
295
 
    perror("argp_parse");
 
295
    fprintf(stderr, "Unkown error while parsing arguments\n");
296
296
    exitstatus = EXIT_FAILURE;
297
297
    goto end;
298
298
  }
329
329
    }
330
330
    ret = argp_parse (&argp, new_argc, plus_argv, 0, 0, &plugin_list);
331
331
    if (ret == ARGP_ERR_UNKNOWN){
332
 
      perror("argp_parse");
 
332
      fprintf(stderr, "Unkown error while parsing arguments\n");
333
333
      exitstatus = EXIT_FAILURE;
334
334
      goto end;
335
335
    }
606
606
          /* Bad exit by plugin */
607
607
          if(debug){
608
608
            if(WIFEXITED(proc->status)){
609
 
              fprintf(stderr, "Plugin %d exited with status %d\n",
610
 
                      proc->pid, WEXITSTATUS(proc->status));
 
609
              fprintf(stderr, "Plugin %u exited with status %d\n",
 
610
                      (unsigned int) (proc->pid),
 
611
                      WEXITSTATUS(proc->status));
611
612
            } else if(WIFSIGNALED(proc->status)) {
612
 
              fprintf(stderr, "Plugin %d killed by signal %d\n",
613
 
                      proc->pid, WTERMSIG(proc->status));
 
613
              fprintf(stderr, "Plugin %u killed by signal %d\n",
 
614
                      (unsigned int) (proc->pid),
 
615
                      WTERMSIG(proc->status));
614
616
            } else if(WCOREDUMP(proc->status)){
615
 
              fprintf(stderr, "Plugin %d dumped core\n", proc->pid);
 
617
              fprintf(stderr, "Plugin %d dumped core\n",
 
618
                      (unsigned int) (proc->pid));
616
619
            }
617
620
          }
618
621
          /* Remove the plugin */