/mandos/release

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

« back to all changes in this revision

Viewing changes to plugins.d/usplash.c

Merge from Björn:

* plugin-runner.c (main): Bug fix: For the "--options-for" option, do
                          not mangle arguments with colon characters.
                          Also support adding empty arguments.

* plugins.d/mandos-client.c: (mc): New global variable; moved from
                                   "main".
  (init_gpgme, pgp_packet_decrypt, init_gnutls_global,
  init_gnutls_session, start_mandos_communication): Removed "mc"
                                                    argument.  All
                                                    callers changed.

  (resolve_callback, browse_callback): Ignore "userdata" argument.
                                       All callers changed.
  (handle_sigterm): New function.
  (main): Add "handle_sigterm" as signal handler for SIGTERM before
          starting the main loop.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
                                   dirent */
37
37
#include <stddef.h>             /* NULL */
38
38
#include <string.h>             /* strlen(), memcmp() */
39
 
#include <stdio.h>              /* asprintf(), perror() */
 
39
#include <stdio.h>              /* asprintf(), perror(), sscanf() */
40
40
#include <unistd.h>             /* close(), write(), readlink(),
41
41
                                   read(), STDOUT_FILENO, sleep(),
42
42
                                   fork(), setuid(), geteuid(),
46
46
                                   EXIT_SUCCESS, malloc(), _exit() */
47
47
#include <stdlib.h>             /* getenv() */
48
48
#include <dirent.h>             /* opendir(), readdir(), closedir() */
49
 
#include <inttypes.h>           /* intmax_t, strtoimax() */
 
49
#include <inttypes.h>           /* intmax_t, SCNdMAX */
50
50
#include <sys/stat.h>           /* struct stat, lstat(), S_ISLNK */
51
51
 
52
52
sig_atomic_t interrupted_by_signal = 0;
173
173
      pid_t pid;
174
174
      {
175
175
        intmax_t tmpmax;
176
 
        char *tmp;
177
 
        errno = 0;
178
 
        tmpmax = strtoimax(proc_ent->d_name, &tmp, 10);
179
 
        if(errno != 0 or tmp == proc_ent->d_name or *tmp != '\0'
180
 
           or tmpmax != (pid_t)tmpmax){
 
176
        int numchars;
 
177
        ret = sscanf(proc_ent->d_name, "%" SCNdMAX "%n", &tmpmax,
 
178
                     &numchars);
 
179
        if(ret < 1 or tmpmax != (pid_t)tmpmax
 
180
           or proc_ent->d_name[numchars] != '\0'){
181
181
          /* Not a process */
182
182
          continue;
183
183
        }