/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 plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2008-10-01 15:29:01 UTC
  • Revision ID: teddy@fukt.bsnet.se-20081001152901-fh30whl3m4vb7m24
* debian/changelog: New Debian revision.

* debian/mandos-client.lintian-overrides: Added comments.
* debian/mandos.lintian-overrides: - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Mandos plugin runner - Run Mandos plugins
4
4
 *
5
 
 * Copyright © 2008,2009 Teddy Hogeborn
6
 
 * Copyright © 2008,2009 Björn Påhlsson
 
5
 * Copyright © 2008 Teddy Hogeborn & Björn Påhlsson
7
6
 * 
8
7
 * This program is free software: you can redistribute it and/or
9
8
 * modify it under the terms of the GNU General Public License as
309
308
  struct stat st;
310
309
  fd_set rfds_all;
311
310
  int ret, maxfd = 0;
312
 
  ssize_t sret;
313
311
  uid_t uid = 65534;
314
312
  gid_t gid = 65534;
315
313
  bool debug = false;
547
545
    char *org_line = NULL;
548
546
    char *p, *arg, *new_arg, *line;
549
547
    size_t size = 0;
 
548
    ssize_t sret;
550
549
    const char whitespace_delims[] = " \r\t\f\v\n";
551
550
    const char comment_delim[] = "#";
552
551
 
701
700
      
702
701
      const char const *bad_suffixes[] = { "~", "#", ".dpkg-new",
703
702
                                           ".dpkg-old",
704
 
                                           ".dpkg-bak",
705
703
                                           ".dpkg-divert", NULL };
706
704
      for(const char **pre = bad_prefixes; *pre != NULL; pre++){
707
705
        size_t pre_len = strlen(*pre);
1019
1017
        proc->buffer_size += BUFFER_SIZE;
1020
1018
      }
1021
1019
      /* Read from the process */
1022
 
      sret = read(proc->fd, proc->buffer + proc->buffer_length,
1023
 
                  BUFFER_SIZE);
1024
 
      if(sret < 0){
 
1020
      ret = read(proc->fd, proc->buffer + proc->buffer_length,
 
1021
                 BUFFER_SIZE);
 
1022
      if(ret < 0){
1025
1023
        /* Read error from this process; ignore the error */
1026
1024
        proc = proc->next;
1027
1025
        continue;
1028
1026
      }
1029
 
      if(sret == 0){
 
1027
      if(ret == 0){
1030
1028
        /* got EOF */
1031
1029
        proc->eof = true;
1032
1030
      } else {
1033
 
        proc->buffer_length += (size_t) sret;
 
1031
        proc->buffer_length += (size_t) ret;
1034
1032
      }
1035
1033
    }
1036
1034
  }