Change in osmo-trx[master]: trx_rate_ctr: use thread safe strerror() in device_sig_cb()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Tue Oct 26 16:17:30 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/25935 )

Change subject: trx_rate_ctr: use thread safe strerror() in device_sig_cb()
......................................................................

trx_rate_ctr: use thread safe strerror() in device_sig_cb()

Change-Id: Ibd52af22bbe99652f402ada87410de167a124b73
---
M CommonLibs/trx_rate_ctr.cpp
1 file changed, 5 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved



diff --git a/CommonLibs/trx_rate_ctr.cpp b/CommonLibs/trx_rate_ctr.cpp
index ba4fcc0..a7467c1 100644
--- a/CommonLibs/trx_rate_ctr.cpp
+++ b/CommonLibs/trx_rate_ctr.cpp
@@ -214,6 +214,7 @@
 	struct timespec next_sched = {.tv_sec = 0, .tv_nsec = 20*1000*1000};
 	/* no automatic re-trigger */
 	struct timespec intv_sched = {.tv_sec = 0, .tv_nsec = 0};
+	char err_buf[256];
 
 	switch (signal) {
 	case S_DEVICE_COUNTER_CHANGE:
@@ -222,7 +223,8 @@
 		dev_rate_ctr_mutex.lock();
 		dev_ctrs_pending[dev_ctr->chan] = *dev_ctr;
 		if (osmo_timerfd_schedule(&dev_rate_ctr_timerfd, &next_sched, &intv_sched) < 0) {
-			LOGC(DCTR, ERROR) << "Failed to schedule timerfd: " << errno << " = "<< strerror(errno);
+			LOGC(DCTR, ERROR) << "Failed to schedule timerfd: " << errno
+					  << " = "<< strerror_r(errno, err_buf, sizeof(err_buf));
 		}
 		dev_rate_ctr_mutex.unlock();
 		break;
@@ -232,7 +234,8 @@
 		trx_rate_ctr_mutex.lock();
 		trx_ctrs_pending[trx_ctr->chan] = *trx_ctr;
 		if (osmo_timerfd_schedule(&trx_rate_ctr_timerfd, &next_sched, &intv_sched) < 0) {
-			LOGC(DCTR, ERROR) << "Failed to schedule timerfd: " << errno << " = "<< strerror(errno);
+			LOGC(DCTR, ERROR) << "Failed to schedule timerfd: " << errno
+					  << " = "<< strerror_r(errno, err_buf, sizeof(err_buf));
 		}
 		trx_rate_ctr_mutex.unlock();
 		break;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/25935
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Ibd52af22bbe99652f402ada87410de167a124b73
Gerrit-Change-Number: 25935
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211026/5e7946a6/attachment.htm>


More information about the gerrit-log mailing list