diff options
author | Zdenek Prikryl <zprikryl@redhat.com> | 2009-06-11 17:18:04 +0200 |
---|---|---|
committer | Zdenek Prikryl <zprikryl@redhat.com> | 2009-06-11 17:18:04 +0200 |
commit | e7b5a3a7eb78a6d79572b2362707c5bbe9c32aa4 (patch) | |
tree | 90ba2d3b730be92cc7e31488dba8aae8f26d3aba /lib/CommLayer | |
parent | 75db7fd0ea56cfa648e9ac30230a0fe3349d39cd (diff) | |
download | abrt-e7b5a3a7eb78a6d79572b2362707c5bbe9c32aa4.tar.gz abrt-e7b5a3a7eb78a6d79572b2362707c5bbe9c32aa4.tar.xz abrt-e7b5a3a7eb78a6d79572b2362707c5bbe9c32aa4.zip |
fixed socket creation
Diffstat (limited to 'lib/CommLayer')
-rw-r--r-- | lib/CommLayer/CommLayerServerSocket.cpp | 7 |
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, |