[PATCH v3 6/7] Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)
Adhemerval Zanella
adhemerval.zanella@linaro.org
Wed Dec 5 19:18:00 GMT 2018
On 05/12/2018 17:11, Gabriel F. T. Gomes wrote:
> 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?
>
I would suggest you to integrate it on the patch which fixes BZ#11319
and from my side you don't need to send an update version.
More information about the Libc-alpha
mailing list