[patch v2] fgets: more tests

Florian Weimer fweimer@redhat.com
Wed Sep 4 11:26:14 GMT 2024


* DJ Delorie:

> Add more tests for unusual situations fgets() might see:
>
> * zero size file
> * zero sized buffer
> * NULL buffer
> * NUL data
> * writable stream
> * closed stream

There are still some style issues, missing space after sizeof:

+  TEST_COMPARE_BLOB (buf + (len), sizeof(buf) - (len),	\
+		     buf2, sizeof(buf) - (len));
+  returned_string = fgets (buf, sizeof(buf) - 1, f);
+  returned_string = fgets (buf, sizeof(buf) - 1, f);
+  returned_string = fgets (null, sizeof(buf), f);
+  returned_string = fgets (buf, sizeof(buf) - 1, f);
+  returned_string = fgets (buf, sizeof(buf) - 1, f);
+  returned_string = fgets (buf, sizeof(buf) - 1, f);
+  returned_string = fgets (buf, sizeof(buf) - 1, null);
+  returned_string = fgets (buf, sizeof(buf) - 1, f);

Please fix them before committing.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian



More information about the Libc-alpha mailing list