wc: Fix SIGINFO race with casper init.

If a file is specified then fileargs_init(3) may return [EINTR]. With
the SIGINFO handler not being SA_RESTART this causes an early exit
if a SIGINFO comes in. Rather than checking for [EINTR] or changing the
handler just move it later which resolves the problem.
This commit is contained in:
Bryan Drewery 2024-02-18 10:55:11 -08:00
parent a890a3a5dd
commit d0bf8b5aac
1 changed files with 1 additions and 2 deletions

View File

@ -117,8 +117,6 @@ main(int argc, char *argv[])
argv += optind; argv += optind;
argc -= optind; argc -= optind;
(void)signal(SIGINFO, siginfo_handler);
fa = fileargs_init(argc, argv, O_RDONLY, 0, fa = fileargs_init(argc, argv, O_RDONLY, 0,
cap_rights_init(&rights, CAP_READ, CAP_FSTAT), FA_OPEN); cap_rights_init(&rights, CAP_READ, CAP_FSTAT), FA_OPEN);
if (fa == NULL) if (fa == NULL)
@ -137,6 +135,7 @@ main(int argc, char *argv[])
xo_open_container("wc"); xo_open_container("wc");
xo_open_list("file"); xo_open_list("file");
(void)signal(SIGINFO, siginfo_handler);
errors = 0; errors = 0;
total = 0; total = 0;
if (argc == 0) { if (argc == 0) {