mirror of
				https://gitlab.com/80486DX2-66/gists
				synced 2025-05-31 08:31:41 +05:30 
			
		
		
		
	freadln.c: set errno to EINVAL if *output is NULL
				
					
				
			This commit is contained in:
		@@ -37,8 +37,10 @@ int freadln(FILE* f, char** output, size_t* length_out) {
 | 
				
			|||||||
	freadln_length_type length = 0; // initial length
 | 
						freadln_length_type length = 0; // initial length
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*output = malloc((length + 1) * sizeof(char));
 | 
						*output = malloc((length + 1) * sizeof(char));
 | 
				
			||||||
	if (*output == NULL)
 | 
						if (*output == NULL) {
 | 
				
			||||||
 | 
							errno = EINVAL;
 | 
				
			||||||
		return freadln_ERROR;
 | 
							return freadln_ERROR;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int character;
 | 
						int character;
 | 
				
			||||||
	while ((character = fgetc(f)) != EOF
 | 
						while ((character = fgetc(f)) != EOF
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user