/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/mandos-client.c

  • Committer: teddy at recompile
  • Date: 2020-04-08 18:32:02 UTC
  • mfrom: (1213 trunk)
  • mto: This revision was merged to the branch mainline in revision 1214.
  • Revision ID: teddy@recompile.se-20200408183202-41yudnki868l26sy
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1074
1074
      ret = setgid(0);
1075
1075
      if(ret == -1){
1076
1076
        perror_plus("setgid");
 
1077
        close(devnull);
1077
1078
        _exit(EX_NOPERM);
1078
1079
      }
1079
1080
      /* Reset supplementary groups */
1081
1082
      ret = setgroups(0, NULL);
1082
1083
      if(ret == -1){
1083
1084
        perror_plus("setgroups");
 
1085
        close(devnull);
1084
1086
        _exit(EX_NOPERM);
1085
1087
      }
1086
1088
    }
1087
1089
    ret = dup2(devnull, STDIN_FILENO);
1088
1090
    if(ret == -1){
1089
1091
      perror_plus("dup2(devnull, STDIN_FILENO)");
 
1092
      close(devnull);
1090
1093
      _exit(EX_OSERR);
1091
1094
    }
1092
1095
    ret = close(devnull);
1093
1096
    if(ret == -1){
1094
1097
      perror_plus("close");
1095
 
      _exit(EX_OSERR);
1096
1098
    }
1097
1099
    ret = dup2(STDERR_FILENO, STDOUT_FILENO);
1098
1100
    if(ret == -1){
1133
1135
  }
1134
1136
  if(pid == -1){
1135
1137
    perror_plus("fork");
 
1138
    close(devnull);
1136
1139
    return false;
1137
1140
  }
 
1141
  ret = close(devnull);
 
1142
  if(ret == -1){
 
1143
    perror_plus("close");
 
1144
  }
1138
1145
  int status;
1139
1146
  pid_t pret = -1;
1140
1147
  errno = 0;