Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Fix wrong initial semaphore state #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/key-value-store/pers_low_level_db_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ sint_t pers_lldb_open(str_t const* dbPathname, pers_lldb_purpose_e ePurpose, boo
DLT_LOG(persComLldbDLTCtx, DLT_LOG_INFO,
DLT_STRING(LT_HDR); DLT_STRING(__FUNCTION__); DLT_STRING(": semaphore already exists: "); DLT_STRING(strerror(error)));
//try to open existing semaphore
pLldbHandler->kissDb.kdbSem = sem_open(pLldbHandler->kissDb.semName, O_CREAT, 0644, 0);
pLldbHandler->kissDb.kdbSem = sem_open(pLldbHandler->kissDb.semName, O_CREAT, 0644, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite of comment above (try to open existing semaphore), sometimes the semaphore does not exist when set_open is called, in this case it will be created with incorrect 0 value.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the tests are still running successfully, I think we can accecpt the suggested modification.
Did you run the tests?

error = errno;
if (pLldbHandler->kissDb.kdbSem == SEM_FAILED) //open failed
{
Expand Down