/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/usplash.c

  • Committer: Teddy Hogeborn
  • Date: 2009-01-13 04:35:19 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090113043519-0yr39snphoegq8l1
* plugin-runner.c: Only space changes.
* plugins.d/mandos-client.c: - '' -
* plugins.d/password-prompt.c: - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
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, SCNdMAX */
50
49
#include <sys/stat.h>           /* struct stat, lstat(), S_ISLNK */
51
50
 
52
51
sig_atomic_t interrupted_by_signal = 0;
171
170
        proc_ent != NULL;
172
171
        proc_ent = readdir(proc_dir)){
173
172
      pid_t pid;
174
 
      {
175
 
        intmax_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
 
          /* Not a process */
182
 
          continue;
183
 
        }
184
 
        pid = (pid_t)tmpmax;
 
173
      /* In the GNU C library, pid_t is always int */
 
174
      ret = sscanf(proc_ent->d_name, "%d", &pid);
 
175
      if(ret != 1){
 
176
        /* Not a process */
 
177
        continue;
185
178
      }
186
179
      /* Find the executable name by doing readlink() on the
187
180
         /proc/<pid>/exe link */