summaryrefslogtreecommitdiff
path: root/src/lib/irm.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-02-26 16:08:09 +0100
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-02-26 16:08:09 +0100
commitf02e1f68905a563e1d73a298e0de0e5da8b2eb9f (patch)
treef87e7d2a7e5a9c789a47561b8a715152aac24e43 /src/lib/irm.c
parent0ab26ce5ae6c80313e55e3251cc0ee180419f696 (diff)
downloadouroboros-f02e1f68905a563e1d73a298e0de0e5da8b2eb9f.tar.gz
ouroboros-f02e1f68905a563e1d73a298e0de0e5da8b2eb9f.zip
lib: Fix two errors
Fixes two errors in the library. The return code of a write to a socket was ignored. A non literal string was passed to sprintf as a literal one.
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r--src/lib/irm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/irm.c b/src/lib/irm.c
index 2c9b530c..69a98039 100644
--- a/src/lib/irm.c
+++ b/src/lib/irm.c
@@ -46,13 +46,17 @@ int irm_create_ipcp(rina_name_t name,
msg.msgs.create_ipcp.ipcp_type = ipcp_type;
buf = serialize_irm_msg(&msg);
- if (buf == NULL)
+ if (buf == NULL) {
+ close(sockfd);
return -1;
+ }
- write(sockfd, buf->data, buf->size);
+ if (write(sockfd, buf->data, buf->size) == -1) {
+ close(sockfd);
+ return -1;
+ }
close(sockfd);
-
return 0;
}