[PATCH v3 6/7] Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)
Gabriel F. T. Gomes
gabriel@inconstante.eti.br
Wed Dec 5 19:12:00 GMT 2018
On Wed, 05 Dec 2018, Adhemerval Zanella wrote:
>
>For a lack of a better interface (to create/open read-only temporary files
>or memfd_create), I think it would be simpler to:
>
>static int
>do_test (void)
>{
> char *tempfile;
> int fd;
>
> /* Create a temporary file and open it in read-only mode. */
> TEST_VERIFY_EXIT (create_temp_file ("tst-bz11319", &tempfile));
> fd = xopen (tempfile, O_RDONLY, 0660);
>
> /* Try and write to the temporary file to intentionally fail, then
> check that dprintf (or __dprintf_chk) return EOF. */
> TEST_COMPARE (dprintf (fd, "%d", 0), EOF);
>
> xclose (fd);
> free (tempfile);
>
> return 0;
>}
Looks good to me. Should I post an updated version, or is it OK with the
suggested changes?
More information about the Libc-alpha
mailing list