qemu_find_file: check name as a straight path even if it has no '/'
Make qemu_find_file() check for the passed in name as a straight pathname even if it doesn't have any path separator character in it. This means that "-bios foo", "-dtb foo" etc will find a file 'foo' in the current directory. This removes an inconsistency with -kernel and -initrd, which both accept plain filenames as meaning files in the current directory. It's also less confusing for the user than an undocumented restriction that "this option accepts a filename, except for the special case where the filename you pass happens not to have a '/' in it, in which case we'll ignore it." Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
		
							parent
							
								
									9233685597
								
							
						
					
					
						commit
						31783203c3
					
				
							
								
								
									
										5
									
								
								vl.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								vl.c
									
									
									
									
									
								
							| @ -1795,9 +1795,8 @@ char *qemu_find_file(int type, const char *name) | ||||
|     const char *subdir; | ||||
|     char *buf; | ||||
| 
 | ||||
|     /* If name contains path separators then try it as a straight path.  */ | ||||
|     if ((strchr(name, '/') || strchr(name, '\\')) | ||||
|         && access(name, R_OK) == 0) { | ||||
|     /* Try the name as a straight path first */ | ||||
|     if (access(name, R_OK) == 0) { | ||||
|         return g_strdup(name); | ||||
|     } | ||||
|     switch (type) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Peter Maydell
						Peter Maydell