/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/password-prompt.c

* plugins.d/mandos-client.c (main): Do not handle ignored signals.
                                    Bug fix: remove signal handler
                                    before re-raising signal.

* plugins.d/password-prompt.c (main): Check return values from
                                      "sigaddset()".

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
  }
130
130
  
131
131
  sigemptyset(&new_action.sa_mask);
132
 
  sigaddset(&new_action.sa_mask, SIGINT);
133
 
  sigaddset(&new_action.sa_mask, SIGHUP);
134
 
  sigaddset(&new_action.sa_mask, SIGTERM);
135
 
  ret = sigaction(SIGINT, NULL, &old_action);
136
 
  if(ret == -1){
137
 
    perror("sigaction");
 
132
  ret = sigaddset(&new_action.sa_mask, SIGINT);
 
133
  if(ret == -1){
 
134
    perror("sigaddset");
 
135
    return EXIT_FAILURE;
 
136
  }
 
137
  ret = sigaddset(&new_action.sa_mask, SIGHUP);
 
138
  if(ret == -1){
 
139
    perror("sigaddset");
 
140
    return EXIT_FAILURE;
 
141
  }
 
142
  ret = sigaddset(&new_action.sa_mask, SIGTERM);
 
143
  if(ret == -1){
 
144
    perror("sigaddset");
138
145
    return EXIT_FAILURE;
139
146
  }
140
147
  /* Need to check if the handler is SIG_IGN before handling:
141
148
     | [[info:libc:Initial Signal Actions]] |
142
149
     | [[info:libc:Basic Signal Handling]]  |
143
150
  */
 
151
  ret = sigaction(SIGINT, NULL, &old_action);
 
152
  if(ret == -1){
 
153
    perror("sigaction");
 
154
    return EXIT_FAILURE;
 
155
  }
144
156
  if(old_action.sa_handler != SIG_IGN){
145
157
    ret = sigaction(SIGINT, &new_action, NULL);
146
158
    if(ret == -1){