Marcus, > Unfortunately this doesn't work on all platforms. > Windows fails to open > files in this mode, so I'm guessing > it's some GCC extension we can't use.
If my memory is not bogus, the same effect under windows could be achieved by: int fd = _open("filename", _O_RDWR | _O_APPEND | _O_CREAT | _O_TRUNC ); FILE * stream = _fdopen(fd, "a+"); -Dmitry On 2016-01-15 16:22, Marcus Larsson wrote: > Hi Dmitry, > > On 01/15/2016 08:52 AM, Marcus Larsson wrote: >> >> On 01/14/2016 04:28 PM, Dmitry Samersoff wrote: >>> Marcus, >>> >>> fopen(name, "wa+") truncate file before open it in append mode. >> >> Ah, didn't know you could do that. If it works that would be much >> better, I'll give it a shot. > > Unfortunately this doesn't work on all platforms. Windows fails to open > files in this mode, so I'm guessing it's some GCC extension we can't use. > > Thanks, > Marcus > >> >> Thanks, >> Marcus >> >>> >>> -Dmitry >>> >>> On 2016-01-14 18:00, Marcus Larsson wrote: >>>> Hi, >>>> >>>> Please review the following patch to make sure UL truncates existing >>>> log >>>> files before writing to them. Since files are opened in append mode, >>>> truncation isn't done automatically, so instead the patch adds an >>>> attempt to remove the log file before opening it. >>>> >>>> Webrev: >>>> http://cr.openjdk.java.net/~mlarsson/8146879/webrev.00/ >>>> >>>> Issue: >>>> https://bugs.openjdk.java.net/browse/JDK-8146879 >>>> >>>> Testing: >>>> Included test through JPRT >>>> >>>> Thanks, >>>> Marcus >>> >> > -- Dmitry Samersoff Oracle Java development team, Saint Petersburg, Russia * I would love to change the world, but they won't give me the source code.