From 7145a50f5315c2f2a04d31c4d93e8e1387c9948d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 7 Sep 2012 07:07:07 +0000 Subject: Remove exit calls from sp_sync_read_timeout and sp_synchronize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add return values to sp_synchronize so we can signal a failure to the only upstream caller (serprog_init), which is prepared to propagate a failure. sp_sync_read_timeout was harder to fix because it already used a return value, but we needed to distinguish two different failure modes. This solution distinguishes them by the sign of the return values, which maintains readability as much as possible. Thanks to Niklas Söderlund for the original patch and idea. Corresponding to flashrom svn r1595. Signed-off-by: Niklas Söderlund Signed-off-by: Stefan Tauner Acked-by: Stefan Tauner --- serial.c | 1 + 1 file changed, 1 insertion(+) (limited to 'serial.c') diff --git a/serial.c b/serial.c index 05c7d04..7e47dcc 100644 --- a/serial.c +++ b/serial.c @@ -239,6 +239,7 @@ void sp_flush_incoming(void) #ifdef _WIN32 PurgeComm(sp_fd, PURGE_RXCLEAR); #else + /* FIXME: error handling */ tcflush(sp_fd, TCIFLUSH); #endif return; -- cgit v1.1