/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 Hogeborn
  • Date: 2019-08-05 21:14:05 UTC
  • mto: This revision was merged to the branch mainline in revision 388.
  • Revision ID: teddy@recompile.se-20190805211405-9m6hecekaihpttz9
Override lintian warnings about upgrading from old versions

There are some really things which are imperative that we fix in case
someone were to upgrade from a really old version.  We want to keep
these fixes in the postinst maintainer scripts, even though lintian
complains about such old upgrades not being supported by Debian in
general.  We prefer the code being there, for the sake of the users.

* debian/mandos-client.lintian-overrides
  (maintainer-script-supports-ancient-package-version): New.
  debian/mandos.lintian-overrides
  (maintainer-script-supports-ancient-package-version): - '' -

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-2011 Teddy Hogeborn
6
 
 * Copyright © 2008-2011 Björn Påhlsson
7
 
 * 
8
 
 * This program is free software: you can redistribute it and/or
9
 
 * modify it under the terms of the GNU General Public License as
10
 
 * published by the Free Software Foundation, either version 3 of the
11
 
 * License, or (at your option) any later version.
12
 
 * 
13
 
 * This program is distributed in the hope that it will be useful, but
 
5
 * Copyright © 2008-2018 Teddy Hogeborn
 
6
 * Copyright © 2008-2018 Björn Påhlsson
 
7
 * 
 
8
 * This file is part of Mandos.
 
9
 * 
 
10
 * Mandos is free software: you can redistribute it and/or modify it
 
11
 * under the terms of the GNU General Public License as published by
 
12
 * the Free Software Foundation, either version 3 of the License, or
 
13
 * (at your option) any later version.
 
14
 * 
 
15
 * Mandos is distributed in the hope that it will be useful, but
14
16
 * WITHOUT ANY WARRANTY; without even the implied warranty of
15
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
18
 * General Public License for more details.
17
19
 * 
18
20
 * You should have received a copy of the GNU General Public License
19
 
 * along with this program.  If not, see
20
 
 * <http://www.gnu.org/licenses/>.
 
21
 * along with Mandos.  If not, see <http://www.gnu.org/licenses/>.
21
22
 * 
22
23
 * Contact the authors at <mandos@recompile.se>.
23
24
 */
58
59
const char usplash_name[] = "/sbin/usplash";
59
60
 
60
61
/* Function to use when printing errors */
 
62
__attribute__((format (gnu_printf, 3, 4)))
61
63
void error_plus(int status, int errnum, const char *formatstring,
62
64
                ...){
63
65
  va_list ap;
66
68
  
67
69
  va_start(ap, formatstring);
68
70
  ret = vasprintf(&text, formatstring, ap);
69
 
  if (ret == -1){
 
71
  if(ret == -1){
70
72
    fprintf(stderr, "Mandos plugin %s: ",
71
73
            program_invocation_short_name);
72
74
    vfprintf(stderr, formatstring, ap);
116
118
      ret = asprintf(&cmd_line_alloc, "%s %s", cmd, arg);
117
119
      if(ret == -1){
118
120
        int e = errno;
119
 
        TEMP_FAILURE_RETRY(close(*fifo_fd_r));
 
121
        close(*fifo_fd_r);
120
122
        errno = e;
121
123
        return false;
122
124
      }
132
134
                 cmd_line_len - written);
133
135
    if(sret == -1){
134
136
      int e = errno;
135
 
      TEMP_FAILURE_RETRY(close(*fifo_fd_r));
 
137
      close(*fifo_fd_r);
136
138
      free(cmd_line_alloc);
137
139
      errno = e;
138
140
      return false;
490
492
        error_plus(0, errno, "read");
491
493
        status = EX_OSERR;
492
494
      }
493
 
      TEMP_FAILURE_RETRY(close(outfifo_fd));
 
495
      close(outfifo_fd);
494
496
      goto failure;
495
497
    }
496
498
    if(interrupted_by_signal){
577
579
  
578
580
  /* Close FIFO */
579
581
  if(fifo_fd != -1){
580
 
    ret = (int)TEMP_FAILURE_RETRY(close(fifo_fd));
 
582
    ret = close(fifo_fd);
581
583
    if(ret == -1 and errno != EINTR){
582
584
      error_plus(0, errno, "close");
583
585
    }
586
588
  
587
589
  /* Close output FIFO */
588
590
  if(outfifo_fd != -1){
589
 
    ret = (int)TEMP_FAILURE_RETRY(close(outfifo_fd));
 
591
    ret = close(outfifo_fd);
590
592
    if(ret == -1){
591
593
      error_plus(0, errno, "close");
592
594
    }
654
656
  
655
657
  /* Close FIFO (again) */
656
658
  if(fifo_fd != -1){
657
 
    ret = (int)TEMP_FAILURE_RETRY(close(fifo_fd));
 
659
    ret = close(fifo_fd);
658
660
    if(ret == -1 and errno != EINTR){
659
661
      error_plus(0, errno, "close");
660
662
    }