Print this page
Matt's code review fixes


2698                                                 changelist_free(clp);
2699                                         }
2700                                 }
2701                         }
2702 
2703                         nvlist_free(renamed);
2704                 }
2705         }
2706 
2707         /*
2708          * Get the fs specified by the first path in the stream (the top level
2709          * specified by 'zfs send') and pass it to each invocation of
2710          * zfs_receive_one().
2711          */
2712         (void) strlcpy(sendfs, drr->drr_u.drr_begin.drr_toname,
2713             ZFS_MAXNAMELEN);
2714         if ((cp = strchr(sendfs, '@')) != NULL) {
2715                 *cp = '\0';
2716                 /*
2717                  * Find the "sendsnap", the final snapshot in a replication
2718                  * stream, so zfs_receive_one() can set filesystem properties
2719                  * ONLY when receiving that final snapshot.

2720                  */
2721                 sendsnap = (cp + 1);
2722         }
2723 
2724         /* Finally, receive each contained stream */
2725         do {
2726                 /*
2727                  * we should figure out if it has a recoverable
2728                  * error, in which case do a recv_skip() and drive on.
2729                  * Note, if we fail due to already having this guid,
2730                  * zfs_receive_one() will take care of it (ie,
2731                  * recv_skip() and return 0).
2732                  */
2733                 error = zfs_receive_impl(hdl, destname, NULL, flags, fd,
2734                     sendfs, stream_nv, stream_avl, top_zfs, cleanup_fd,
2735                     action_handlep, sendsnap);
2736                 if (error == ENODATA) {
2737                         error = 0;
2738                         break;
2739                 }




2698                                                 changelist_free(clp);
2699                                         }
2700                                 }
2701                         }
2702 
2703                         nvlist_free(renamed);
2704                 }
2705         }
2706 
2707         /*
2708          * Get the fs specified by the first path in the stream (the top level
2709          * specified by 'zfs send') and pass it to each invocation of
2710          * zfs_receive_one().
2711          */
2712         (void) strlcpy(sendfs, drr->drr_u.drr_begin.drr_toname,
2713             ZFS_MAXNAMELEN);
2714         if ((cp = strchr(sendfs, '@')) != NULL) {
2715                 *cp = '\0';
2716                 /*
2717                  * Find the "sendsnap", the final snapshot in a replication
2718                  * stream.  zfs_receive_one() handles certain errors
2719                  * differently, depending on if the contained stream is the
2720                  * last one or not.
2721                  */
2722                 sendsnap = (cp + 1);
2723         }
2724 
2725         /* Finally, receive each contained stream */
2726         do {
2727                 /*
2728                  * we should figure out if it has a recoverable
2729                  * error, in which case do a recv_skip() and drive on.
2730                  * Note, if we fail due to already having this guid,
2731                  * zfs_receive_one() will take care of it (ie,
2732                  * recv_skip() and return 0).
2733                  */
2734                 error = zfs_receive_impl(hdl, destname, NULL, flags, fd,
2735                     sendfs, stream_nv, stream_avl, top_zfs, cleanup_fd,
2736                     action_handlep, sendsnap);
2737                 if (error == ENODATA) {
2738                         error = 0;
2739                         break;
2740                 }