This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: Do not open .gcda/.gcno files in write mode unnecessarily.


Neil Vachharajani wrote:
GCC currently always opens .gcda/.gcno files in write mode.  This
leads to permission denied errors when opening these files if the
files are read-only.  Having read-only .gcda files is useful to ensure
that one does not unintentionally modify profile data (by default, an
instrumented binary will append to .gcda files).  This patch modifies
the behavior of gcov_open to only open the file in write mode if the
MODE argument is >= 0.

Bootstrapped/regtested on x86_64-linux and i686-linux.  Verified that
FDO still works.  Ok for trunk?

2009-09-17 Neil Vachharajani <nvachhar@gmail.com>

* gcov-io.c (gcov_open): Open files read-only when MODE < 0

Can you protect the new read-only code with #if !IN_LIBGCOV, so we don't unnecessarily bloat that? It looks like that's the locking calls as the open call is already in such a #if block.


nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery


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