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 <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes #8593
char *atp, *copy;
int err = 0;
int c;
+ struct sigaction sa;
while ((c = getopt(argc, argv, "FHt")) != -1) {
switch (c) {
* 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);