block/raw-win32: Always use -errno in hdev_open
On one occasion, hdev_open() returned -1 in case of an unknown error instead of a proper -errno value. Adjust this to match the behavior of raw_open() (in raw-win32), which is to return -EINVAL in this case. Also, change the call to error_setg*() to match the one in raw_open() as well. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
		
							parent
							
								
									a7fdbcf0e6
								
							
						
					
					
						commit
						45d57f6e71
					
				| @ -590,12 +590,11 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags, | |||||||
|         int err = GetLastError(); |         int err = GetLastError(); | ||||||
| 
 | 
 | ||||||
|         if (err == ERROR_ACCESS_DENIED) { |         if (err == ERROR_ACCESS_DENIED) { | ||||||
|             error_setg_errno(errp, EACCES, "Could not open device"); |  | ||||||
|             ret = -EACCES; |             ret = -EACCES; | ||||||
|         } else { |         } else { | ||||||
|             error_setg(errp, "Could not open device"); |             ret = -EINVAL; | ||||||
|             ret = -1; |  | ||||||
|         } |         } | ||||||
|  |         error_setg_errno(errp, -ret, "Could not open device"); | ||||||
|         goto done; |         goto done; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Max Reitz
						Max Reitz