block: Fix the use of protocols in backing files
Backing filenames may contain a protocol. The code currently doesn't consider this case and produces filenames that embed "<protocol>:". Don't combine filenames if the backing filename contains a protocol. Based on an earlier patch by Anthony Liguori <aliguori@us.ibm.com>. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
		
							parent
							
								
									9e0b22f4f2
								
							
						
					
					
						commit
						df2dbb4a50
					
				
							
								
								
									
										14
									
								
								block.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								block.c
									
									
									
									
									
								
							| @ -611,10 +611,18 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, | ||||
|         BlockDriver *back_drv = NULL; | ||||
| 
 | ||||
|         bs->backing_hd = bdrv_new(""); | ||||
|         path_combine(backing_filename, sizeof(backing_filename), | ||||
|                      filename, bs->backing_file); | ||||
|         if (bs->backing_format[0] != '\0') | ||||
| 
 | ||||
|         if (path_has_protocol(bs->backing_file)) { | ||||
|             pstrcpy(backing_filename, sizeof(backing_filename), | ||||
|                     bs->backing_file); | ||||
|         } else { | ||||
|             path_combine(backing_filename, sizeof(backing_filename), | ||||
|                          filename, bs->backing_file); | ||||
|         } | ||||
| 
 | ||||
|         if (bs->backing_format[0] != '\0') { | ||||
|             back_drv = bdrv_find_format(bs->backing_format); | ||||
|         } | ||||
| 
 | ||||
|         /* backing files always opened read-only */ | ||||
|         back_flags = | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Stefan Hajnoczi
						Stefan Hajnoczi