Show error if failing to unlink old socket

This is in response to issue #183.
This commit is contained in:
Allan Odgaard
2012-08-18 01:27:40 +02:00
parent 7f177f1345
commit c7f267cd12

View File

@@ -124,7 +124,11 @@ namespace
mate_server_t () : _socket_path(path::join(path::temp(), "textmate.sock"))
{
D(DBF_RMateServer, bug("%s\n", _socket_path.c_str()););
unlink(_socket_path.c_str());
if(unlink(_socket_path.c_str()) == -1 && errno != ENOENT)
{
OakRunIOAlertPanel("Unable to delete socket left from old instance:\n%s", _socket_path.c_str());
return;
}
socket_t fd(socket(AF_UNIX, SOCK_STREAM, 0));
fcntl(fd, F_SETFD, 1);