mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Reject zfs send -RI with nonexistent fromsnap
Right now, zfs send -I dataset@nonexistent dataset@existent fails, but zfs send -RI dataset@nonexistent dataset@existent does not. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rich Ercolani <rincebrain@gmail.com> Closes #12574 Closes #12575
This commit is contained in:
		
							parent
							
								
									fc18fa92c8
								
							
						
					
					
						commit
						271241187b
					
				| @ -2144,6 +2144,23 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap, | ||||
| 		return (zfs_error(zhp->zfs_hdl, EZFS_NOENT, errbuf)); | ||||
| 	} | ||||
| 
 | ||||
| 	if (fromsnap) { | ||||
| 		char full_fromsnap_name[ZFS_MAX_DATASET_NAME_LEN]; | ||||
| 		if (snprintf(full_fromsnap_name, sizeof (full_fromsnap_name), | ||||
| 		    "%s@%s", zhp->zfs_name, fromsnap) >= | ||||
| 		    sizeof (full_fromsnap_name)) { | ||||
| 			err = EINVAL; | ||||
| 			goto stderr_out; | ||||
| 		} | ||||
| 		zfs_handle_t *fromsnapn = zfs_open(zhp->zfs_hdl, | ||||
| 		    full_fromsnap_name, ZFS_TYPE_SNAPSHOT); | ||||
| 		if (fromsnapn == NULL) { | ||||
| 			err = -1; | ||||
| 			goto err_out; | ||||
| 		} | ||||
| 		zfs_close(fromsnapn); | ||||
| 	} | ||||
| 
 | ||||
| 	if (flags->replicate || flags->doall || flags->props || | ||||
| 	    flags->holds || flags->backup) { | ||||
| 		char full_tosnap_name[ZFS_MAX_DATASET_NAME_LEN]; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Rich Ercolani
						Rich Ercolani