Open jenny-cheung opened 3 years ago
Hi, developers, the lock may not be released if the open open(lpk->fname, O_WRONLY|O_APPEND|O_CREAT, 0640) fails. Thank you for your checking. https://github.com/etolabo/kumofs/blob/b0f7ce8263194dbfa92d10ae75849e676e77c067/src/log/logpack.c#L265 https://github.com/etolabo/kumofs/blob/b0f7ce8263194dbfa92d10ae75849e676e77c067/src/log/logpack.c#L252
open(lpk->fname, O_WRONLY|O_APPEND|O_CREAT, 0640)
int logpack_reopen(logpack_t* lpk) { if(logpack_lock(lpk) < 0) { return -1; } int tmp = open(lpk->fname, O_WRONLY|O_APPEND|O_CREAT, 0640); if(tmp < 0) { return -1; // without releasing } close(lpk->logfd); lpk->logfd = tmp; logpack_unlock(lpk); return 0; }
Hi, developers @hirose31 @frsyuki
Any comments would be highly appreciated. Thank you.
Best Regards,
Hi, developers, the lock may not be released if the open
open(lpk->fname, O_WRONLY|O_APPEND|O_CREAT, 0640)
fails. Thank you for your checking. https://github.com/etolabo/kumofs/blob/b0f7ce8263194dbfa92d10ae75849e676e77c067/src/log/logpack.c#L265 https://github.com/etolabo/kumofs/blob/b0f7ce8263194dbfa92d10ae75849e676e77c067/src/log/logpack.c#L252