/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-10-02 17:41:05 UTC
  • mto: (24.1.169 mandos)
  • mto: This revision was merged to the branch mainline in revision 453.
  • Revision ID: teddy@fukt.bsnet.se-20101002174105-xfqa0j8y1puvedo3
* debian/source/format: New; contains "3.0 (quilt)".

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Usplash - Read a password from usplash and output it
4
4
 * 
5
 
 * Copyright © 2008,2009 Teddy Hogeborn
6
 
 * Copyright © 2008,2009 Björn Påhlsson
 
5
 * Copyright © 2008-2010 Teddy Hogeborn
 
6
 * Copyright © 2008-2010 Björn Påhlsson
7
7
 * 
8
8
 * This program is free software: you can redistribute it and/or
9
9
 * modify it under the terms of the GNU General Public License as
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);