##// END OF EJS Templates
chg: verify return value of sigaction() and sigemptyset()...
Yuya Nishihara -
r28085:c0d1bf1b default
parent child Browse files
Show More
@@ -241,14 +241,22 b' static void setupsignalhandler(pid_t pid'
241 memset(&sa, 0, sizeof(sa));
241 memset(&sa, 0, sizeof(sa));
242 sa.sa_handler = forwardsignal;
242 sa.sa_handler = forwardsignal;
243 sa.sa_flags = SA_RESTART;
243 sa.sa_flags = SA_RESTART;
244 sigemptyset(&sa.sa_mask);
244 if (sigemptyset(&sa.sa_mask) < 0)
245 goto error;
245
246
246 sigaction(SIGHUP, &sa, NULL);
247 if (sigaction(SIGHUP, &sa, NULL) < 0)
247 sigaction(SIGINT, &sa, NULL);
248 goto error;
249 if (sigaction(SIGINT, &sa, NULL) < 0)
250 goto error;
248
251
249 /* terminate frontend by double SIGTERM in case of server freeze */
252 /* terminate frontend by double SIGTERM in case of server freeze */
250 sa.sa_flags |= SA_RESETHAND;
253 sa.sa_flags |= SA_RESETHAND;
251 sigaction(SIGTERM, &sa, NULL);
254 if (sigaction(SIGTERM, &sa, NULL) < 0)
255 goto error;
256 return;
257
258 error:
259 abortmsg("failed to set up signal handlers (errno = %d)", errno);
252 }
260 }
253
261
254 /* This implementation is based on hgext/pager.py (pre 369741ef7253) */
262 /* This implementation is based on hgext/pager.py (pre 369741ef7253) */
General Comments 0
You need to be logged in to leave comments. Login now