Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_con
Modified Files:
ecore_con.c
Log Message:
handle stale sockets gracefully
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_con/ecore_con.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ecore_con.c 11 Oct 2003 22:14:21 -0000 1.4
+++ ecore_con.c 8 Nov 2003 10:45:46 -0000 1.5
@@ -139,6 +139,7 @@
snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i", name, port);
}
pmode = umask(mask);
+ start:
svr->fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (svr->fd < 0)
{
@@ -166,8 +167,31 @@
strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
if (bind(svr->fd, (struct sockaddr *)&socket_unix,
LENGTH_OF_SOCKADDR_UN(&socket_unix)) < 0)
{
- umask(pmode);
- goto error;
+ if (connect(svr->fd, (struct sockaddr *)&socket_unix,
+ LENGTH_OF_SOCKADDR_UN(&socket_unix)) < 0)
+ {
+ if ((type == ECORE_CON_LOCAL_USER) ||
+ (type == ECORE_CON_LOCAL_SYSTEM))
+ {
+ if (unlink(buf) < 0)
+ {
+ umask(pmode);
+ goto error;
+ }
+ else
+ goto start;
+ }
+ else
+ {
+ umask(pmode);
+ goto error;
+ }
+ }
+ else
+ {
+ umask(pmode);
+ goto error;
+ }
}
if (listen(svr->fd, 4096) < 0)
{
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs