/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: 2010-09-26 17:44:43 UTC
  • Revision ID: teddy@fukt.bsnet.se-20100926174443-452k363uuvczuuzg
* mandos-ctl: Also show "LastApprovalRequest" property.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#include <inttypes.h>           /* intmax_t, strtoimax() */
50
50
#include <sys/stat.h>           /* struct stat, lstat(), S_ISLNK */
51
51
#include <sysexits.h>           /* EX_OSERR, EX_UNAVAILABLE */
 
52
#include <argz.h>               /* argz_count(), argz_extract() */
52
53
 
53
54
sig_atomic_t interrupted_by_signal = 0;
54
55
int signal_received;
566
567
    }
567
568
  }
568
569
  
569
 
  /* Create argc and argv for new usplash*/
570
 
  int cmdline_argc = 0;
571
 
  char **cmdline_argv = malloc(sizeof(char *));
572
 
  {
573
 
    size_t position = 0;
574
 
    while(position < cmdline_len){
575
 
      char **tmp = realloc(cmdline_argv,
576
 
                           (sizeof(char *)
577
 
                            * (size_t)(cmdline_argc + 2)));
578
 
      if(tmp == NULL){
579
 
        error(0, errno, "realloc");
580
 
        free(cmdline_argv);
581
 
        return status;
582
 
      }
583
 
      cmdline_argv = tmp;
584
 
      cmdline_argv[cmdline_argc] = cmdline + position;
585
 
      cmdline_argc++;
586
 
      position += strlen(cmdline + position) + 1;
587
 
    }
588
 
    cmdline_argv[cmdline_argc] = NULL;
 
570
  /* Create argv for new usplash*/
 
571
  char **cmdline_argv = malloc((argz_count(cmdline, cmdline_len) + 1)
 
572
                               * sizeof(char *)); /* Count args */
 
573
  if(cmdline_argv == NULL){
 
574
    error(0, errno, "malloc");
 
575
    return status;
589
576
  }
 
577
  argz_extract(cmdline, cmdline_len, cmdline_argv); /* Create argv */
 
578
  
590
579
  /* Kill old usplash */
591
580
  kill(usplash_pid, SIGTERM);
592
581
  sleep(2);