/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/plymouth.c

  • Committer: Teddy Hogeborn
  • Date: 2014-03-06 02:26:04 UTC
  • mto: (237.7.272 trunk)
  • mto: This revision was merged to the branch mainline in revision 311.
  • Revision ID: teddy@recompile.se-20140306022604-4uc43taz25cflgi3
Bug fix: Free all memory and give better messages when memory is full.

* plugin-runner.c (add_to_char_array): Bug fix: If realloc fails, do
                                       not change old array pointer.
  (add_environment): Bug fix: If realloc fails, do not change old
                     environment pointer.  Also rename "e" to "envdef"
                     for clarity.
  (main): Bug fix: If realloc fails, do not change old pointers.  Also
          wrap "#pragma GCC" with "#ifdef ___GNUC___".
* plugins.d/mandos-client.c (incbuffer): Bug fix: if realloc fails,
                                         free old buffer.
  (run_network_hooks): Moved variables "directory" and "ret" to their
                       innermost possible scope.
  (take_down_interface): Moved variables "sd", "ret_errno", and
                         "ret_setflags" to their innermost possible
                         scope.
  (main): Removed variable "interfaces_hooks_size".  Also, if argz_add
          fails when adding all found interfaces, the error message
          will now be correct.  Also print error message if, after
          having taken up an interface, argz_add fails to add
          interface to list of interfaces to be taken down.
* plugins.d/mandos-client.xml (OPTIONS): Explain better what "none"
                                         means as argument to
                                         "--interface" by negating
                                         sense.
* plugins.d/password-prompt.c (fprintf_plus): Removed (unused).

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Plymouth - Read a password from Plymouth and output it
4
4
 * 
5
 
 * Copyright © 2010-2016 Teddy Hogeborn
6
 
 * Copyright © 2010-2016 Björn Påhlsson
 
5
 * Copyright © 2010-2013 Teddy Hogeborn
 
6
 * Copyright © 2010-2013 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
84
84
  
85
85
  va_start(ap, formatstring);
86
86
  ret = vasprintf(&text, formatstring, ap);
87
 
  if(ret == -1){
 
87
  if (ret == -1){
88
88
    fprintf(stderr, "Mandos plugin %s: ",
89
89
            program_invocation_short_name);
90
90
    vfprintf(stderr, formatstring, ap);
179
179
    int i = 0;
180
180
    for (; argv[i]!=NULL; i++){
181
181
      tmp = realloc(new_argv, sizeof(const char *) * ((size_t)i + 1));
182
 
      if(tmp == NULL){
 
182
      if (tmp == NULL){
183
183
        error_plus(0, errno, "realloc");
184
184
        free(new_argv);
185
185
        _exit(EX_OSERR);
290
290
  if(proc_id == 0){
291
291
    struct dirent **direntries = NULL;
292
292
    ret = scandir("/proc", &direntries, is_plymouth, alphasort);
293
 
    if(ret == -1){
 
293
    if (ret == -1){
294
294
      error_plus(0, errno, "scandir");
295
295
    }
296
 
    if(ret > 0){
 
296
    if (ret > 0){
297
297
      ret = sscanf(direntries[0]->d_name, "%" SCNuMAX, &proc_id);
298
 
      if(ret < 0){
 
298
      if (ret < 0){
299
299
        error_plus(0, errno, "sscanf");
300
300
      }
301
301
    }