/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 plugins.d/plymouth.c

  • Committer: Björn Påhlsson
  • Date: 2011-07-25 18:46:19 UTC
  • mfrom: (487 trunk)
  • mto: This revision was merged to the branch mainline in revision 489.
  • Revision ID: belorn@fukt.bsnet.se-20110725184619-l7vfsobr0bh9fc3l
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include <stddef.h>             /* NULL */
37
37
#include <string.h>             /* strchr(), memcmp() */
38
38
#include <stdio.h>              /* asprintf(), perror(), fopen(),
39
 
                                   fscanf(), vasprintf(), fprintf(), vfprintf() */
 
39
                                   fscanf(), vasprintf(), fprintf(),
 
40
                                   vfprintf() */
40
41
#include <unistd.h>             /* close(), readlink(), read(),
41
42
                                   fork(), setsid(), chdir(), dup2(),
42
43
                                   STDERR_FILENO, execv(), access() */
72
73
}
73
74
 
74
75
/* Function to use when printing errors */
75
 
void error_plus(int status, int errnum, const char *formatstring, ...){
 
76
void error_plus(int status, int errnum, const char *formatstring,
 
77
                ...){
76
78
  va_list ap;
77
79
  char *text;
78
80
  int ret;
80
82
  va_start(ap, formatstring);
81
83
  ret = vasprintf(&text, formatstring, ap);
82
84
  if (ret == -1){
83
 
    fprintf(stderr, "Mandos plugin %s: ", program_invocation_short_name);
 
85
    fprintf(stderr, "Mandos plugin %s: ",
 
86
            program_invocation_short_name);
84
87
    vfprintf(stderr, formatstring, ap);
85
88
    fprintf(stderr, ": ");
86
89
    fprintf(stderr, "%s\n", strerror(errnum));
279
282
      }
280
283
    }
281
284
    /* scandir might preallocate for this variable (man page unclear).
282
 
       even if ret == 0, we need to free it. */
 
285
       even if ret == 0, therefore we need to free it. */
283
286
    free(direntries);
284
287
  }
285
288
  pid_t pid;