Comment 2 for bug 1770676

Revision history for this message
Scott Emmons (lscotte) wrote : Re: gcc optimizer bug

To reproduce this in cronolog:

echo hello | cronolog --symlink=/tmp/foo /tmp/foo.%Y%m%d-%H%M%S.log

This will create a new log every second (effectively each time the command is run). The correct behavior is that the /tmp/foo symlink should move to the new log file. In the broken case, the link does not move due to the if statement of "prevlinkname" returning true when it should be false [1]. If you test the value of "prevlinkname" for NULL before and after the stat(prevlinkname...) call at L250 (similar to my testcase.c), the pointer is no longer null after the call to stat().

[1] https://github.com/fordmason/cronolog/blob/master/src/cronoutils.c#L256