diff --git a/c-programming/io/freadln.c b/c-programming/io/freadln.c index 290b7df..82e20b0 100644 --- a/c-programming/io/freadln.c +++ b/c-programming/io/freadln.c @@ -27,8 +27,10 @@ int freadln(FILE* f, char** output, size_t* length_out) { * freadln_ERROR: an error occurred (see errno) */ - if (output == NULL) + if (output == NULL) { + errno = EINVAL; return freadln_ERROR; + } // NOTE: if the file is STDIN, flush STDOUT before waiting for input to // make sure a prompt is displayed