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

  • Committer: Teddy Hogeborn
  • Date: 2009-10-18 16:09:05 UTC
  • Revision ID: teddy@fukt.bsnet.se-20091018160905-ep07o5cwedsegz9x
* plugins.d/askpass-fifo.c: Do close(STDOUT_FILENO) before exiting to
                            check its return code.  Use exit codes
                            from <sysexits.h>.
* plugins.d/splashy.c: Use exit codes from <sysexits.h> in the fork to
                       exec the "splashy_update" command.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
                                   STDOUT_FILENO, _exit(),
44
44
                                   pause() */
45
45
#include <string.h>             /* memcmp() */
46
 
#include <errno.h>              /* errno */
 
46
#include <errno.h>              /* errno, EACCES, ENOTDIR, ELOOP,
 
47
                                   ENOENT, ENAMETOOLONG, EMFILE,
 
48
                                   ENFILE, ENOMEM, ENOEXEC, EINVAL,
 
49
                                   E2BIG, EFAULT, EIO, ETXTBSY,
 
50
                                   EISDIR, ELIBBAD, EPERM, EINTR,
 
51
                                   ECHILD */
47
52
#include <sys/wait.h>           /* waitpid(), WIFEXITED(),
48
53
                                   WEXITSTATUS() */
49
 
 
50
54
#include <sysexits.h>           /* EX_OSERR, EX_OSFILE,
51
55
                                   EX_UNAVAILABLE */
52
56
 
288
292
    if(not interrupted_by_signal){
289
293
      const char splashy_command[] = "/sbin/splashy_update";
290
294
      execl(splashy_command, splashy_command, prompt, (char *)NULL);
 
295
      int e = errno;
291
296
      perror("execl");
 
297
      switch(e){
 
298
      case EACCES:
 
299
      case ENOENT:
 
300
      case ENOEXEC:
 
301
      case EINVAL:
 
302
        _exit(EX_UNAVAILABLE);
 
303
      case ENAMETOOLONG:
 
304
      case E2BIG:
 
305
      case ENOMEM:
 
306
      case EFAULT:
 
307
      case EIO:
 
308
      case EMFILE:
 
309
      case ENFILE:
 
310
      case ETXTBSY:
 
311
      default:
 
312
        _exit(EX_OSERR);
 
313
      case ENOTDIR:
 
314
      case ELOOP:
 
315
      case EISDIR:
 
316
      case ELIBBAD:
 
317
      case EPERM:
 
318
        _exit(EX_OSFILE);
 
319
      }
292
320
    }
293
321
    free(prompt);
294
322
    _exit(EXIT_FAILURE);