author | Sebastian Harl <sh@tokkee.org> | |
Tue, 24 Feb 2009 10:27:22 +0000 (11:27 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 24 Feb 2009 10:37:17 +0000 (11:37 +0100) | ||
commit | da70cd0f24be40b2d76a9dd88ff8264b52c989bd | |
tree | 5d11b359620bb3ddfc6382ba7bd501c7bbbbe989 | tree | snapshot |
parent | a0655e74b5a60232463f71ae266bf143fe30364f | commit | diff |
src/common.c: Fixed a race condition in check_create_dir().
Between checking for the existence of a directory using stat() and creating
the directory using mkdir(), another thread might have already created the
directory thus causing mkdir() to fail with errno == EEXIST. This case is now
handled sanely, no longer causing the function (and thus some write callback)
to fail in this case.
Most likely, this only happens during startup when creating the data
directories - later, no two threads should try to create the same directory.
Interestingly enough, I frequently encountered this issue on a single core
machine.
Between checking for the existence of a directory using stat() and creating
the directory using mkdir(), another thread might have already created the
directory thus causing mkdir() to fail with errno == EEXIST. This case is now
handled sanely, no longer causing the function (and thus some write callback)
to fail in this case.
Most likely, this only happens during startup when creating the data
directories - later, no two threads should try to create the same directory.
Interestingly enough, I frequently encountered this issue on a single core
machine.
src/common.c | diff | blob | history |