| 58 |
FILE *fp; |
FILE *fp; |
| 59 |
int ret; |
int ret; |
| 60 |
int last_aid; |
int last_aid; |
| 61 |
|
struct sigaction act = {0}; |
| 62 |
|
|
| 63 |
// Parse args |
// Parse args |
| 64 |
for (int i = 1; i < argc; i++) |
for (int i = 1; i < argc; i++) |
| 254 |
log_common("Initially load %d articles, last_aid = %d\n", article_block_article_count(), article_block_last_aid()); |
log_common("Initially load %d articles, last_aid = %d\n", article_block_article_count(), article_block_last_aid()); |
| 255 |
|
|
| 256 |
// Set signal handler |
// Set signal handler |
| 257 |
signal(SIGHUP, sig_hup_handler); |
act.sa_handler = sig_hup_handler; |
| 258 |
signal(SIGCHLD, sig_chld_handler); |
if (sigaction(SIGHUP, &act, NULL) == -1) |
| 259 |
signal(SIGTERM, sig_term_handler); |
{ |
| 260 |
|
log_error("set signal action of SIGHUP error: %d\n", errno); |
| 261 |
|
goto cleanup; |
| 262 |
|
} |
| 263 |
|
act.sa_handler = sig_chld_handler; |
| 264 |
|
if (sigaction(SIGCHLD, &act, NULL) == -1) |
| 265 |
|
{ |
| 266 |
|
log_error("set signal action of SIGCHLD error: %d\n", errno); |
| 267 |
|
goto cleanup; |
| 268 |
|
} |
| 269 |
|
act.sa_handler = sig_term_handler; |
| 270 |
|
if (sigaction(SIGTERM, &act, NULL) == -1) |
| 271 |
|
{ |
| 272 |
|
log_error("set signal action of SIGTERM error: %d\n", errno); |
| 273 |
|
goto cleanup; |
| 274 |
|
} |
| 275 |
|
|
| 276 |
// Launch section_list_loader process |
// Launch section_list_loader process |
| 277 |
if (section_list_loader_launch() < 0) |
if (section_list_loader_launch() < 0) |