Module: kamailio
Branch: master
Commit: a61ff084bc87c7d3dd05b14afd35795b466d37dc
URL:
https://github.com/kamailio/kamailio/commit/a61ff084bc87c7d3dd05b14afd35795…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2016-05-12T22:08:28+02:00
sms: fix compiler warning #612 (#617)
* show error message if error in write
CC (clang) [M sms.so] libsms_modem.o
libsms_modem.c:77:2: warning: ignoring return value of function declared with
warn_unused_result attribute [-Wunused-result]
write(mdm->fd,cmd,cmd_len);
^~~~~ ~~~~~~~~~~~~~~~~~~~
1 warning generated.
---
Modified: modules/sms/libsms_modem.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a61ff084bc87c7d3dd05b14afd35795…
Patch:
https://github.com/kamailio/kamailio/commit/a61ff084bc87c7d3dd05b14afd35795…
---
diff --git a/modules/sms/libsms_modem.c b/modules/sms/libsms_modem.c
index d0f5b33..e9d88fa 100644
--- a/modules/sms/libsms_modem.c
+++ b/modules/sms/libsms_modem.c
@@ -74,7 +74,9 @@ int put_command( struct modem *mdm, char* cmd, int cmd_len, char*
answer,
LM_DBG("-<%d>-->[%.*s] \n",cmd_len,cmd_len,cmd);
#endif
/* send the command to the modem */
- write(mdm->fd,cmd,cmd_len);
+ if (write(mdm->fd,cmd,cmd_len)<0) {
+ LM_ERR("write error: %s\n", strerror(errno));
+ }
tcdrain(mdm->fd);
/* read from the modem */