/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/password-prompt.c

  • Committer: Teddy Hogeborn
  • Date: 2009-03-15 04:22:14 UTC
  • mfrom: (326 mandos)
  • mto: This revision was merged to the branch mainline in revision 327.
  • Revision ID: teddy@fukt.bsnet.se-20090315042214-gvps0knkvuyewtxl
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
                                   ARGP_KEY_ARG, ARGP_KEY_END,
52
52
                                   ARGP_ERR_UNKNOWN */
53
53
 
54
 
volatile bool quit_now = false;
 
54
volatile sig_atomic_t quit_now = 0;
55
55
bool debug = false;
56
56
const char *argp_program_version = "password-prompt " VERSION;
57
57
const char *argp_program_bug_address = "<mandos@fukt.bsnet.se>";
58
58
 
59
59
static void termination_handler(__attribute__((unused))int signum){
60
 
  quit_now = true;
 
60
  quit_now = 1;
61
61
}
62
62
 
63
63
int main(int argc, char **argv){
80
80
      { .name = NULL }
81
81
    };
82
82
    
83
 
    error_t parse_opt (int key, char *arg, struct argp_state *state) {
84
 
      switch (key) {
 
83
    error_t parse_opt (int key, char *arg, struct argp_state *state){
 
84
      switch (key){
85
85
      case 'p':
86
86
        prefix = arg;
87
87
        break;
194
194
      const char *cryptsource = getenv("cryptsource");
195
195
      const char *crypttarget = getenv("crypttarget");
196
196
      const char *const prompt
197
 
        = "Enter passphrase to unlock the disk";
 
197
        = "Enter passphrase to unlock the disk";      
198
198
      if(cryptsource == NULL){
199
199
        if(crypttarget == NULL){
200
200
          fprintf(stderr, "%s: ", prompt);
242
242
    /* if(ret == 0), then the only sensible thing to do is to retry to
243
243
       read from stdin */
244
244
    fputc('\n', stderr);
245
 
    if(debug and not quit_now){
246
 
      /* If quit_now is true, we were interrupted by a signal, and
 
245
    if(debug and quit_now == 0){
 
246
      /* If quit_now is nonzero, we were interrupted by a signal, and
247
247
         will print that later, so no need to show this too. */
248
248
      fprintf(stderr, "getline() returned 0, retrying.\n");
249
249
    }