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
Fri Nov 13 21:58:41 UTC 2020


pespin has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/42/21142/1

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-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201113/0ee92da3/attachment.htm>


More information about the gerrit-log mailing list