Commit 55428cc3 by Laurent Alfonsi Committed by Jeff Law

re PR gcov-profile/58602 (.gcno files not truncated at gcov_close)

	PR gcov-profile/58602
        * gcc/gcov-io.c (gcov_open): Open with truncation when mode<0

From-SVN: r207441
parent 85942f45
2014-02-03 Laurent Aflonsi <laurent.alfonsi@st.com>
PR gcov-profile/58602
* gcc/gcov-io.c (gcov_open): Open with truncation when mode<0
2014-02-03 Jan Hubicka <hubicka@ucw.cz>
PR ipa/59831
......
......@@ -149,9 +149,15 @@ gcov_open (const char *name, int mode)
/* pass mode (ignored) for compatibility */
fd = open (name, O_RDONLY, S_IRUSR | S_IWUSR);
}
else
else if (mode < 0)
{
/* Write mode - acquire a write-lock. */
s_flock.l_type = F_WRLCK;
fd = open (name, O_RDWR | O_CREAT | O_TRUNC, 0666);
}
else /* mode == 0 */
{
/* Write mode - acquire a write-lock. */
/* Read-Write mode - acquire a write-lock. */
s_flock.l_type = F_WRLCK;
fd = open (name, O_RDWR | O_CREAT, 0666);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment