Module: kamailio
Branch: master
Commit: 47aa94c694e5471fa85bb15c372f9120876e4927
URL: https://github.com/kamailio/kamailio/commit/47aa94c694e5471fa85bb15c372f912…
Author: tsearle <tsearle(a)gmail.com>
Committer: tsearle <tsearle(a)gmail.com>
Date: 2016-02-25T09:56:09+01:00
core/futex: fix bug in futex_try
atomic_cmpxchg returns the previous value. If the previous value was 0 then it was previously unlocked and we now have acquired the lock.
Thus, it should be c==0 that is considered as the case we enter the lock, not c!=0
As far as I can tell, lock_try (and lock_set_try) are currently no used anywhere in the code, so this fix shoudn't have any impact
---
Modified: futexlock.h
---
Diff: https://github.com/kamailio/kamailio/commit/47aa94c694e5471fa85bb15c372f912…
Patch: https://github.com/kamailio/kamailio/commit/47aa94c694e5471fa85bb15c372f912…
---
diff --git a/futexlock.h b/futexlock.h
index 7aa7c73..db2fca4 100644
--- a/futexlock.h
+++ b/futexlock.h
@@ -142,7 +142,7 @@ static inline int futex_try(futex_lock_t* lock)
{
int c;
c=atomic_cmpxchg(lock, 0, 1);
- if (likely(c))
+ if (likely(c==0))
membar_enter_lock();
return c;
}
atomic_cmpxchg returns the previous value. If the previous value was 0 then it was previously unlocked and we now have acquired the lock.
Thus, it should be c==0 that is considered as the case we enter the lock, not c!=0
As far as I can tell, lock_try (and lock_set_try) are currently no used anywhere in the code, so this fix shoudn't have any impact
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/520
-- Commit Summary --
* core/futex: fix bug in futex_try
-- File Changes --
M futexlock.h (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/520.patchhttps://github.com/kamailio/kamailio/pull/520.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/520
Complete re-implementation of sdp_remove_line_by_prefix(), maybe reviewing by diff does not make sense.
Also feedback is on unit test is welcome as I have not created such for Kamailio earlier.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/522
-- Commit Summary --
* modules/sdpops: reimplement sdp_remove_line_by_prefix() to fix shortcomings
* test/unit: add unit test for sdpops script function sdp_remove_line_by_prefix()
-- File Changes --
M modules/sdpops/sdpops_mod.c (118)
A test/unit/60-message-sdp0.sip (18)
A test/unit/60-message-sdp1.sip (18)
A test/unit/60-message-sdp2.sip (19)
A test/unit/60-message-sdp3.sip (19)
A test/unit/60-message-sdp4.sip (20)
A test/unit/60-message-sdp5.sip (20)
A test/unit/60-message-sdp6.sip (20)
A test/unit/60-message-sdp7.sip (19)
A test/unit/60.cfg (41)
A test/unit/60.sh (75)
A test/unit/include/require.sh (65)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/522.patchhttps://github.com/kamailio/kamailio/pull/522.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/522