// by connecting to it.
SCIM_DEBUG_SOCKET (2) << "Try to remove the broken socket file: " << data_un->sun_path << "\n";
- if (::access (data_un->sun_path, F_OK) == 0) {
- SocketClient tmp_socket (addr);
-
- if (!tmp_socket.is_connected ()) {
- struct stat statbuf;
-
- // If it's a socket file, then
- // delete it.
- if (::stat (data_un->sun_path, &statbuf) == 0 && S_ISSOCK (statbuf.st_mode))
- ::unlink (data_un->sun_path);
- }
-
- tmp_socket.close ();
+ SocketClient tmp_socket (addr);
+ if (!tmp_socket.is_connected ()) {
+ LOGE ("the connection is broken");
+ if (::unlink (data_un->sun_path) != 0)
+ LOGE ("unlink() failed");
}
+
+ tmp_socket.close ();
}
if (::bind (m_id, data, len) == 0) {