This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 6/7] Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]