From 5b1443c47e4ae5c53f343f3d0fb81d8d963c3d95 Mon Sep 17 00:00:00 2001 From: Tomohiro Kusumi Date: Wed, 10 Apr 2019 01:58:03 +0900 Subject: [PATCH] Use sigaction(2) instead of sigset(3) for portability sigset(3) isn't portable. This code fails to compile on platforms without sigset(3). Use sigaction(2). -- largest_file.c: In function 'main': largest_file.c:75:9: error: implicit declaration of function 'sigset'; did you mean 'sigvec'? [-Werror=implicit-function-declaration] (void) sigset(SIGXFSZ, sigxfsz); ^~~~~~ sigvec Reviewed-by: Brian Behlendorf Signed-off-by: Tomohiro Kusumi Closes #8593 --- tests/zfs-tests/cmd/largest_file/largest_file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/zfs-tests/cmd/largest_file/largest_file.c b/tests/zfs-tests/cmd/largest_file/largest_file.c index 5e6a18660..d1eceaf56 100644 --- a/tests/zfs-tests/cmd/largest_file/largest_file.c +++ b/tests/zfs-tests/cmd/largest_file/largest_file.c @@ -67,12 +67,18 @@ main(int argc, char **argv) char mybuf[5] = "aaaa\0"; char *testfile; mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; + struct sigaction sa; if (argc != 2) { usage(argv[0]); } - (void) sigset(SIGXFSZ, sigxfsz); + if (sigemptyset(&sa.sa_mask) == -1) + return (errno); + sa.sa_flags = 0; + sa.sa_handler = sigxfsz; + if (sigaction(SIGXFSZ, &sa, NULL) == -1) + return (errno); testfile = strdup(argv[1]); -- 2.40.0