Use function format attribute where applicable
Allow the compiler to verify the format string against the supplied
arguments.
    chage.c:239:51: warning: format not a string literal, format string not checked [-Wformat-nonliteral]
      239 |                 (void) strftime (buf, sizeof buf, format, tp);
          |                                                   ^~~~~~
			
			
This commit is contained in:
		
				
					committed by
					
						
						Serge Hallyn
					
				
			
			
				
	
			
			
			
						parent
						
							477c8e6f42
						
					
				
				
					commit
					c6c8130db4
				
			@@ -109,7 +109,7 @@ int reset_selinux_file_context (void)
 | 
			
		||||
/*
 | 
			
		||||
 *  Log callback for libselinux internal error reporting.
 | 
			
		||||
 */
 | 
			
		||||
__attribute__((__format__ (printf, 2, 3)))
 | 
			
		||||
format_attr(printf, 2, 3)
 | 
			
		||||
static int selinux_log_cb (int type, const char *fmt, ...) {
 | 
			
		||||
	va_list ap;
 | 
			
		||||
	char *buf;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user