mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	driver: Fix crashes on missing cli arguments
This commit is contained in:
		
							parent
							
								
									46838172c2
								
							
						
					
					
						commit
						54a97f8bb7
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -92,8 +92,15 @@ int getopt(int argc, char **argv, const char *optstring) | ||||||
| 		return optopt; | 		return optopt; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	optarg = argv[++optind]; | 	if (++optind >= argc) { | ||||||
|  | 		fprintf(stderr, "%s: option '-%c' expects an argument\n", argv[0], optopt); | ||||||
|  | 		optopt = '?'; | ||||||
|  | 		return optopt; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	optarg = argv[optind]; | ||||||
| 	optind++, optcur = 1; | 	optind++, optcur = 1; | ||||||
|  | 
 | ||||||
| 	return optopt; | 	return optopt; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue