Skip to content

Commit

Permalink
test/zdtm/autofs: use sigaction instead of the deprecated siginterrupt
Browse files Browse the repository at this point in the history
Reported-by: Mr Travis
Signed-off-by: Andrei Vagin <[email protected]>
  • Loading branch information
avagin committed Jul 16, 2020
1 parent df2610b commit 958b750
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/zdtm/static/autofs.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,6 @@ static int automountd_loop(int pipe, const char *mountpoint, struct autofs_param
return -ENOMEM;
}

/* Allow SIGUSR2 to interrupt system call */
siginterrupt(SIGUSR2, 1);

while (!stop && !err) {
memset(packet, 0, psize);

Expand Down Expand Up @@ -874,6 +871,13 @@ struct autofs_params autofs_types[] = {

int main(int argc, char **argv)
{
struct sigaction act = {
.sa_handler = do_stop,
/*
* SIGUSR2 is used to interrupt system calls, so SA_RESTART
* isn't set.
*/
};
int ret = 0;

test_init(argc, argv);
Expand All @@ -889,7 +893,7 @@ int main(int argc, char **argv)
if (autofs_dev < 0)
return -1;

if (signal(SIGUSR2, do_stop) == SIG_ERR) {
if (sigaction(SIGUSR2, &act, NULL) < 0) {
pr_perror("Failed to set SIGUSR2 handler");
return -1;
}
Expand Down

0 comments on commit 958b750

Please sign in to comment.