/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to plugins.d/usplash.c

  • Committer: teddy at bsnet
  • Date: 2011-11-12 18:14:55 UTC
  • mto: (237.7.70 trunk)
  • mto: This revision was merged to the branch mainline in revision 290.
  • Revision ID: teddy@fukt.bsnet.se-20111112181455-8m6z4qrrib33bl2c
* plugins.d/mandos-client.c (SYNOPSIS, OPTIONS): Document
                                                 "--network-hook-dir"
                                                 option.

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-2015 Teddy Hogeborn
6
 
 * Copyright © 2008-2015 Björn Påhlsson
 
5
 * Copyright © 2008-2011 Teddy Hogeborn
 
6
 * Copyright © 2008-2011 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
58
58
const char usplash_name[] = "/sbin/usplash";
59
59
 
60
60
/* Function to use when printing errors */
61
 
__attribute__((format (gnu_printf, 3, 4)))
62
61
void error_plus(int status, int errnum, const char *formatstring,
63
62
                ...){
64
63
  va_list ap;
67
66
  
68
67
  va_start(ap, formatstring);
69
68
  ret = vasprintf(&text, formatstring, ap);
70
 
  if(ret == -1){
 
69
  if (ret == -1){
71
70
    fprintf(stderr, "Mandos plugin %s: ",
72
71
            program_invocation_short_name);
73
72
    vfprintf(stderr, formatstring, ap);
117
116
      ret = asprintf(&cmd_line_alloc, "%s %s", cmd, arg);
118
117
      if(ret == -1){
119
118
        int e = errno;
120
 
        close(*fifo_fd_r);
 
119
        TEMP_FAILURE_RETRY(close(*fifo_fd_r));
121
120
        errno = e;
122
121
        return false;
123
122
      }
133
132
                 cmd_line_len - written);
134
133
    if(sret == -1){
135
134
      int e = errno;
136
 
      close(*fifo_fd_r);
 
135
      TEMP_FAILURE_RETRY(close(*fifo_fd_r));
137
136
      free(cmd_line_alloc);
138
137
      errno = e;
139
138
      return false;
491
490
        error_plus(0, errno, "read");
492
491
        status = EX_OSERR;
493
492
      }
494
 
      close(outfifo_fd);
 
493
      TEMP_FAILURE_RETRY(close(outfifo_fd));
495
494
      goto failure;
496
495
    }
497
496
    if(interrupted_by_signal){
578
577
  
579
578
  /* Close FIFO */
580
579
  if(fifo_fd != -1){
581
 
    ret = close(fifo_fd);
 
580
    ret = (int)TEMP_FAILURE_RETRY(close(fifo_fd));
582
581
    if(ret == -1 and errno != EINTR){
583
582
      error_plus(0, errno, "close");
584
583
    }
587
586
  
588
587
  /* Close output FIFO */
589
588
  if(outfifo_fd != -1){
590
 
    ret = close(outfifo_fd);
 
589
    ret = (int)TEMP_FAILURE_RETRY(close(outfifo_fd));
591
590
    if(ret == -1){
592
591
      error_plus(0, errno, "close");
593
592
    }
655
654
  
656
655
  /* Close FIFO (again) */
657
656
  if(fifo_fd != -1){
658
 
    ret = close(fifo_fd);
 
657
    ret = (int)TEMP_FAILURE_RETRY(close(fifo_fd));
659
658
    if(ret == -1 and errno != EINTR){
660
659
      error_plus(0, errno, "close");
661
660
    }