aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs/libzfs_sendrecv.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-06-09 13:41:55 -0700
committerBrian Behlendorf <[email protected]>2011-06-09 13:58:48 -0700
commit1b9d8c340f89ca00b0bc99bb0f8a532e2e7a3a1d (patch)
treee96c89dd6c1b42b88e07a8f5e0dbc46c8b78eff7 /lib/libzfs/libzfs_sendrecv.c
parentcbc6fab65c201e44de9bda083cfaab209c6b4f7a (diff)
Fix 'zfs send -D' segfault
Sending pools with dedup results in a segfault due to a Solaris portability issue. Under Solaris the pipe(2) library call creates a bidirectional data channel. Unfortunately, on Linux pipe(2) call creates unidirection data channel. The fix is to use the socketpair(2) function to create the expected bidirectional channel. Seth Heeren did the original leg work on this issue for zfs-fuse. We finally just rediscovered the same portability issue and dfurphy was able to point me at the original issue for the fix. Closes #268
Diffstat (limited to 'lib/libzfs/libzfs_sendrecv.c')
-rw-r--r--lib/libzfs/libzfs_sendrecv.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
index 94e64e63f..7a95de075 100644
--- a/lib/libzfs/libzfs_sendrecv.c
+++ b/lib/libzfs/libzfs_sendrecv.c
@@ -50,6 +50,7 @@
#include "libzfs_impl.h"
#include <sys/zio_checksum.h>
#include <sys/ddt.h>
+#include <sys/socket.h>
/* in libzfs_dataset.c */
extern void zfs_setprop_error(libzfs_handle_t *, zfs_prop_t, int, char *);
@@ -1300,7 +1301,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
if (flags.dedup) {
featureflags |= (DMU_BACKUP_FEATURE_DEDUP |
DMU_BACKUP_FEATURE_DEDUPPROPS);
- if ((err = pipe(pipefd))) {
+ if ((err = socketpair(AF_UNIX, SOCK_STREAM, 0, pipefd))) {
zfs_error_aux(zhp->zfs_hdl, strerror(errno));
return (zfs_error(zhp->zfs_hdl, EZFS_PIPEFAILED,
errbuf));