Commit 1e2e2e7
committed
libs/eventsfile: fix race condition when rotating log file
The condition to know if file rotation should take place can be accessed
in a concurrent manner by 2 or more threads. One thread can enter the if
block and open a new file and close the current one while the other thread
still tries to write to the current logfile that has been closedl!
This leads to segfault.
Let's move the mutex before the block to prevent this race condition.
Signed-off-by: Cedric CHEDALEUX <cedric.chedaleux@orange.com>1 parent 4af3a83 commit 1e2e2e7
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | | - | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
0 commit comments