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

  • Committer: Teddy Hogeborn
  • Date: 2009-09-04 16:32:22 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090904163222-l9wp25ng1e5ym0yq
* plugin-runner.c (main): When a plugin is killed by a signal, show
                          the signal name, not just the number, in the
                          debug log message.

* plugins.d/password-prompt.c (termination_handler): Store received
                                                     signal in
                                                     "signal_received".
  (main): If exiting due to signal, re-raise signal received instead
          of returning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * along with this program.  If not, see
20
20
 * <http://www.gnu.org/licenses/>.
21
21
 * 
22
 
 * Contact the authors at <mandos@fukt.bsnet.se>.
 
22
 * Contact the authors at <https://www.fukt.bsnet.se/~belorn/> and
 
23
 * <https://www.fukt.bsnet.se/~teddy/>.
23
24
 */
24
25
 
25
26
#define _GNU_SOURCE             /* getline() */
128
129
  }
129
130
  
130
131
  sigemptyset(&new_action.sa_mask);
131
 
  ret = sigaddset(&new_action.sa_mask, SIGINT);
132
 
  if(ret == -1){
133
 
    perror("sigaddset");
134
 
    return EXIT_FAILURE;
135
 
  }
136
 
  ret = sigaddset(&new_action.sa_mask, SIGHUP);
137
 
  if(ret == -1){
138
 
    perror("sigaddset");
139
 
    return EXIT_FAILURE;
140
 
  }
141
 
  ret = sigaddset(&new_action.sa_mask, SIGTERM);
142
 
  if(ret == -1){
143
 
    perror("sigaddset");
 
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");
144
138
    return EXIT_FAILURE;
145
139
  }
146
140
  /* Need to check if the handler is SIG_IGN before handling:
147
141
     | [[info:libc:Initial Signal Actions]] |
148
142
     | [[info:libc:Basic Signal Handling]]  |
149
143
  */
150
 
  ret = sigaction(SIGINT, NULL, &old_action);
151
 
  if(ret == -1){
152
 
    perror("sigaction");
153
 
    return EXIT_FAILURE;
154
 
  }
155
144
  if(old_action.sa_handler != SIG_IGN){
156
145
    ret = sigaction(SIGINT, &new_action, NULL);
157
146
    if(ret == -1){