mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	getopt is not required to set optarg to NULL when there is no argument
and some do not, so set it explicitly each time.
This commit is contained in:
		@@ -75,6 +75,7 @@ args_parse(const char *template, int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	optreset = 1;
 | 
			
		||||
	optind = 1;
 | 
			
		||||
	optarg = NULL;
 | 
			
		||||
 | 
			
		||||
	while ((opt = getopt(argc, argv, template)) != -1) {
 | 
			
		||||
		if (opt < 0)
 | 
			
		||||
@@ -84,6 +85,7 @@ args_parse(const char *template, int argc, char **argv)
 | 
			
		||||
			return (NULL);
 | 
			
		||||
		}
 | 
			
		||||
		args_set(args, opt, optarg);
 | 
			
		||||
		optarg = NULL;
 | 
			
		||||
	}
 | 
			
		||||
	argc -= optind;
 | 
			
		||||
	argv += optind;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user