[omniORB] bugreport (+patch): omniORB does not delete existing Unix Endpoints
on startup
Bastiaan Bakker
Bastiaan.Bakker@lifeline.nl
Wed Nov 20 13:04:00 2002
Hi,
If you define a Unix endpoint for your omniORB server, e.g. with
-ORBendPoint giop:unix:/tmp/server.socket, omniORB will create a Unix
socket with that file name or if that name points to a directory create
a Unix socket in that directory.
If in the first case the file (/tmp/server.socket) already exists on
startup, omniORB should delete it in order to be able to create a new
socket.
At least on Linux this does not work:
omniORB incorrectly recognizes the existing socket file as a directory
and will attempt to create a socket in that directory (wich fails of
course).
The cause is in src/lib/omniORB/orbcore/unix/unixTransportImpl.cc, where
it checks whether the file is a directory with 'sb.st_mode & S_IFDIR'.
According to the man pages this is not POSIX correct and should be
S_ISDIR(sb.st_mode). For some reason, on Linux, socket files also have
the S_IFDIR bit set.
The trivial patch for this is included below.
Regards,
Bastiaan Bakker
LifeLine Networks bv
Index: src/lib/omniORB/orbcore/unix/unixTransportImpl.cc
===================================================================
RCS file:
/opt/cvs/sourceroot/omniorb/omniORB4/src/lib/omniORB/orbcore/unix/unixTransportImpl.cc,v
retrieving revision 1.1.1.1
diff -u -u -r1.1.1.1 unixTransportImpl.cc
--- src/lib/omniORB/orbcore/unix/unixTransportImpl.cc 4 Nov 2002
16:32:25 -0000 1.1.1.1
+++ src/lib/omniORB/orbcore/unix/unixTransportImpl.cc 20 Nov 2002
12:35:00 -0000
@@ -134,7 +134,7 @@
}
}
- if (stat(param,&sb) == 0 && (sb.st_mode & S_IFDIR)) {
+ if (stat(param,&sb) == 0 && S_ISDIR(sb.st_mode)) {
const char* format = "%s/%09u-%09u";
fname = CORBA::string_alloc(strlen(param)+24);