This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 6/7] Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)
- From: "Gabriel F. T. Gomes" <gabriel at inconstante dot eti dot br>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 5 Dec 2018 17:11:54 -0200
- Subject: Re: [PATCH v3 6/7] Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)
- References: <20181115214449.19262-1-gabriel@inconstante.eti.br> <20181115214449.19262-7-gabriel@inconstante.eti.br> <878aa68c-1a30-69d6-ae01-4acd6d80ccaa@linaro.org> <20181204141946.26ba9107@tereshkova> <4eff527e-f466-d778-bc14-00727be3e1b1@linaro.org> <20181204160127.0ca1ec00@tereshkova> <99ffe00c-3fd1-ab6b-0bf4-4531583a87ee@linaro.org> <20181205145337.74d49721@tereshkova> <fd9fb96a-fa27-c86d-a429-8e4b740b8079@linaro.org>
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?