diff options
author | Tomohiro Kusumi <[email protected]> | 2019-04-10 01:58:28 +0900 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-04-30 20:46:15 -0700 |
commit | 2a15c00f89468dde08ef48f2d6a3df223c60e723 (patch) | |
tree | cf9ed20547e7b630bdedc5ef6139aa2ae0e0fbfa /cmd/zfs | |
parent | 5b1443c47e4ae5c53f343f3d0fb81d8d963c3d95 (diff) |
Use sigaction(2) instead of sigignore(3) for portability
sigignore(3) isn't portable.
This code fails to compile on platforms without sigignore(3).
Use sigaction(2).
--
zfs_main.c: In function 'zfs_do_diff':
zfs_main.c:7178:9: error: implicit declaration of function 'sigignore' [-Werror=implicit-function-declaration]
(void) sigignore(SIGPIPE);
^~~~~~~~~
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tomohiro Kusumi <[email protected]>
Closes #8593
Diffstat (limited to 'cmd/zfs')
-rw-r--r-- | cmd/zfs/zfs_main.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 90893a857..2d97988a0 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -7195,6 +7195,7 @@ zfs_do_diff(int argc, char **argv) char *atp, *copy; int err = 0; int c; + struct sigaction sa; while ((c = getopt(argc, argv, "FHt")) != -1) { switch (c) { @@ -7252,10 +7253,19 @@ zfs_do_diff(int argc, char **argv) * Ignore SIGPIPE so that the library can give us * information on any failure */ - (void) sigignore(SIGPIPE); + if (sigemptyset(&sa.sa_mask) == -1) { + err = errno; + goto out; + } + sa.sa_flags = 0; + sa.sa_handler = SIG_IGN; + if (sigaction(SIGPIPE, &sa, NULL) == -1) { + err = errno; + goto out; + } err = zfs_show_diffs(zhp, STDOUT_FILENO, fromsnap, tosnap, flags); - +out: zfs_close(zhp); return (err != 0); |