Change in libosmocore[master]: serial: Log error if tcgetattr() or tcsetattr() fail

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/.

pespin gerrit-no-reply at lists.osmocom.org
Sat Nov 14 20:58:38 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/21142 )

Change subject: serial: Log error if tcgetattr() or tcsetattr() fail
......................................................................

serial: Log error if tcgetattr() or tcsetattr() fail

Change-Id: I79121e016f045c9d0555881359cd3008320223ed
---
M src/serial.c
1 file changed, 9 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/src/serial.c b/src/serial.c
index 1c41fe0..72d3594 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -91,8 +91,10 @@
 		goto error;
 	}
 
-	cfsetispeed(&tio, baudrate);
-	cfsetospeed(&tio, baudrate);
+	if (cfsetispeed(&tio, baudrate) < 0)
+		dbg_perror("cfsetispeed()");
+	if (cfsetospeed(&tio, baudrate) < 0)
+		dbg_perror("cfsetospeed()");
 
 	tio.c_cflag &= ~(PARENB | CSTOPB | CSIZE | CRTSCTS);
 	tio.c_cflag |=  (CREAD | CLOCAL | CS8);
@@ -136,8 +138,11 @@
 		dbg_perror("tcgetattr()");
 		return -errno;
 	}
-	cfsetispeed(&tio, baudrate);
-	cfsetospeed(&tio, baudrate);
+
+	if (cfsetispeed(&tio, baudrate) < 0)
+		dbg_perror("cfsetispeed()");
+	if (cfsetospeed(&tio, baudrate) < 0)
+		dbg_perror("cfsetospeed()");
 
 	rc = tcsetattr(fd, TCSANOW, &tio);
 	if (rc < 0) {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I79121e016f045c9d0555881359cd3008320223ed
Gerrit-Change-Number: 21142
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy 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/20201114/bf40f1cd/attachment.htm>


More information about the gerrit-log mailing list