[omniORB] Logging Stream problem

Martin B. 0xCDCDCDCD at gmx.at
Tue Dec 21 08:20:58 GMT 2010


On 20.12.2010 15:33, Roger Wenham wrote:
> Hi,
>
> I have compiled omniORB on AIX 6.1 using gcc version 4.2.0, without problem.
>
> Unfortunately when I start omniNames I get an error message:
>
>    $ ./omniNames -start
>
>    Mon Dec 20 22:04:45 2010:
>
>    Starting omniNames for the first time.
>    Error: cannot create initial log file '/tmp/omninames-tmxd12e.log':
>    No such file or directory
> [...]
>
> The code creates a stream, and then calls the method putPort which raises an exception,
> which produces the above error message.
>
> The uppercase OPEN mystifies me somewhat ...
>

omniNames/log.cc - (73)
   #ifdef HAVE_STD
   #  define USE_STREAM_OPEN
   #  define OPEN(name,mode,perm) open(name,mode)
   #elif defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x500
   #  define USE_STREAM_OPEN
   #  define OPEN(name,mode,perm) open(name,mode,perm)
   #elif defined(__DMC__)
   #  define USE_STREAM_OPEN
   #  define OPEN(name,mode,perm) open(name,mode,perm)
   #elif defined(__ICC)
   #  define USE_STREAM_OPEN
   #  define OPEN(name,mode,perm) open(name,mode,perm)
   #endif

Uppercase OPEN is simply a macro, apparently mapping to .open() calls 
with 2 or 3 parameters.


> ....
>        logf.OPEN(active,ios::out|ios::trunc,0666);
>        if (!logf)
>          throw IOError();
>
>        putPort(port, logf);
> ...
>
> void
> omniNameslog:putPort(int p, ostream&  file)
> {
>    file<<  "port "<<  p<<  '\n';
>    if (!file) throw IOError();
> }
>
> class omniNameslog {
> ....
>    ofstream logf;
>

Also, if the exception is actually raised from the putPort() function, 
then the .open() call succeeded, but writing to the file somehow failed.

See also: http://www.cplusplus.com/reference/iostream/ofstream/

br,
Martin



More information about the omniORB-list mailing list