projects
/
platform
/
framework
/
native
/
channel-service.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add exception check
[platform/framework/native/channel-service.git]
/
src
/
IpcServer.cpp
diff --git
a/src/IpcServer.cpp
b/src/IpcServer.cpp
index
b7bc57b
..
93074cf
100644
(file)
--- a/
src/IpcServer.cpp
+++ b/
src/IpcServer.cpp
@@
-303,7
+303,7
@@
IpcServer::OnConnectionRequest(GIOChannel* source, GIOCondition condition, gpoin
_ChannelInfo* pChannelInfo = null;
GSource* pGSource = null;
GIOChannel* pChannel = null;
_ChannelInfo* pChannelInfo = null;
GSource* pGSource = null;
GIOChannel* pChannel = null;
- ssize_t res = 0;
+ ssize_t re
adByte
s = 0;
int server = -1;
int client = -1;
int server = -1;
int client = -1;
@@
-318,7
+318,9
@@
IpcServer::OnConnectionRequest(GIOChannel* source, GIOCondition condition, gpoin
client = accept(server, (struct sockaddr*) &clientAddress, &clientLen);
SysTryCatch(NID_IO, client != -1, , E_SYSTEM, "[E_SYSTEM] Accept failed.");
client = accept(server, (struct sockaddr*) &clientAddress, &clientLen);
SysTryCatch(NID_IO, client != -1, , E_SYSTEM, "[E_SYSTEM] Accept failed.");
- res = read(client, &helloMessage, sizeof(helloMessage));
+ readBytes = read(client, &helloMessage, sizeof(helloMessage));
+ SysTryCatch(NID_IO, readBytes >= 0, , E_SYSTEM, "[E_SYSTEM] Failed to receive hello message (%d, %s).",
+ errno, strerror(errno));
pChannel = g_io_channel_unix_new(client);
SysTryCatch(NID_IO, pChannel != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");
pChannel = g_io_channel_unix_new(client);
SysTryCatch(NID_IO, pChannel != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");