summaryrefslogtreecommitdiffstats
path: root/lib/CommLayer
diff options
context:
space:
mode:
authorZdenek Prikryl <zprikryl@redhat.com>2009-06-11 17:18:04 +0200
committerZdenek Prikryl <zprikryl@redhat.com>2009-06-11 17:18:04 +0200
commite7b5a3a7eb78a6d79572b2362707c5bbe9c32aa4 (patch)
tree90ba2d3b730be92cc7e31488dba8aae8f26d3aba /lib/CommLayer
parent75db7fd0ea56cfa648e9ac30230a0fe3349d39cd (diff)
downloadabrt-e7b5a3a7eb78a6d79572b2362707c5bbe9c32aa4.tar.gz
abrt-e7b5a3a7eb78a6d79572b2362707c5bbe9c32aa4.tar.xz
abrt-e7b5a3a7eb78a6d79572b2362707c5bbe9c32aa4.zip
fixed socket creation
Diffstat (limited to 'lib/CommLayer')
-rw-r--r--lib/CommLayer/CommLayerServerSocket.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/CommLayer/CommLayerServerSocket.cpp b/lib/CommLayer/CommLayerServerSocket.cpp
index 12db88c9..38571942 100644
--- a/lib/CommLayer/CommLayerServerSocket.cpp
+++ b/lib/CommLayer/CommLayerServerSocket.cpp
@@ -170,13 +170,14 @@ CCommLayerServerSocket::CCommLayerServerSocket()
int len;
struct sockaddr_un local;
+ unlink(SOCKET_PATH);
if ((m_nSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
{
throw CABRTException(EXCEP_FATAL, "CCommLayerServerSocket::CCommLayerServerSocket(): Can not create socket.");
}
+ fcntl(m_nSocket, F_SETFD, FD_CLOEXEC);
local.sun_family = AF_UNIX;
strcpy(local.sun_path, SOCKET_PATH);
- unlink(local.sun_path);
len = strlen(local.sun_path) + sizeof(local.sun_family);
if (bind(m_nSocket, (struct sockaddr *)&local, len) == -1)
{
@@ -186,9 +187,7 @@ CCommLayerServerSocket::CCommLayerServerSocket()
{
throw CABRTException(EXCEP_FATAL, "CCommLayerServerSocket::CCommLayerServerSocket(): Can not listen on the socket.");
}
-
- fcntl(m_nSocket, F_SETFD, FD_CLOEXEC);
- fchmod(m_nSocket, SOCKET_PERMISSION);
+ chmod(SOCKET_PATH, SOCKET_PERMISSION);
m_pGSocket = g_io_channel_unix_new(m_nSocket);
if (!g_io_add_watch(m_pGSocket,