~ubuntu-dev/ubuntu/lucid/dovecot/lucid-201002101901

« back to all changes in this revision

Viewing changes to src/lib/lib-signals.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-06-28 08:45:43 UTC
  • mfrom: (1.10.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060628084543-pc6v7oikzlvnlnu3
Tags: 1.0.beta9-1ubuntu1
* Merge from debian unstable, resolved minor conflicts.
* debian/control: Removed unnecessary build dependency ssl-cert, add it as
  dovecot-common dependency.
* Remove debian/patches/prohibit_.._mbox_mask.dpatch, upstream now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        }
52
52
}
53
53
 
 
54
static void sig_ignore(int signo __attr_unused__)
 
55
{
 
56
        /* if we used SIG_IGN instead of this function,
 
57
           the system call might be restarted */
 
58
}
 
59
 
54
60
static void signal_read(void *context __attr_unused__)
55
61
{
56
62
        unsigned char signal_buf[512];
110
116
                if (sigemptyset(&act.sa_mask) < 0)
111
117
                        i_fatal("sigemptyset(): %m");
112
118
                act.sa_flags = 0;
113
 
                act.sa_handler = handler != NULL ? sig_handler : SIG_IGN;
 
119
                act.sa_handler = handler != NULL ? sig_handler : sig_ignore;
114
120
                if (sigaction(signo, &act, NULL) < 0)
115
121
                        i_fatal("sigaction(%d): %m", signo);
116
122
 
140
146
        signal_handlers[signo] = h;
141
147
}
142
148
 
 
149
void lib_signals_ignore(int signo)
 
150
{
 
151
        struct sigaction act;
 
152
 
 
153
        if (signo < 0 || signo > MAX_SIGNAL_VALUE) {
 
154
                i_panic("Trying to ignore signal %d, but max is %d",
 
155
                        signo, MAX_SIGNAL_VALUE);
 
156
        }
 
157
 
 
158
        i_assert(signal_handlers[signo] == NULL);
 
159
 
 
160
        if (sigemptyset(&act.sa_mask) < 0)
 
161
                i_fatal("sigemptyset(): %m");
 
162
        act.sa_flags = SA_RESTART;
 
163
        act.sa_handler = SIG_IGN;
 
164
 
 
165
        if (sigaction(signo, &act, NULL) < 0)
 
166
                i_fatal("sigaction(%d): %m", signo);
 
167
}
 
168
 
143
169
void lib_signals_unset_handler(int signo, signal_handler_t *handler,
144
170
                               void *context)
145
171
{