diff -Naur omni-4.0.6/src/appl/omniNames/log.cc omni-4.0.6-patched/src/appl/omniNames/log.cc --- omni-4.0.6/src/appl/omniNames/log.cc 2004-02-11 16:49:57.000000000 +0100 +++ omni-4.0.6-patched/src/appl/omniNames/log.cc 2005-09-07 11:54:28.000000000 +0200 @@ -153,7 +153,7 @@ // initialises the ORB and the BOA and calls init(). // -omniNameslog::omniNameslog(int& p,char* logdir) : port(p) +omniNameslog::omniNameslog(int& p,int removelogs,char* logdir) : port(p) { startingUp = 1; checkpointNeeded = 1; @@ -286,15 +286,30 @@ firstTime = 1; +#ifndef __WIN32__ + // + // The logs files will be created with -rw-rw-rw- permissions. + // + mode_t old_umask = umask( 0x0 ); +#endif + if (stat(active,&sb) == 0) { - cerr << ts.t() << "Error: log file '" << active - << "' exists. Can't use -start option." << endl; - exit(1); + if(removelogs) { + unlink(active); + } else { + cerr << ts.t() << "Error: log file '" << active + << "' exists. Can't use -start option." << endl; + exit(1); + } } if (stat(backup,&sb) == 0) { - cerr << ts.t() << "Error: backup file '" << backup - << "' exists. Can't use -start option." << endl; - exit(1); + if( removelogs ) { + unlink(backup); + } else { + cerr << ts.t() << "Error: backup file '" << backup + << "' exists. Can't use -start option." << endl; + exit(1); + } } } else { diff -Naur omni-4.0.6/src/appl/omniNames/log.h omni-4.0.6-patched/src/appl/omniNames/log.h --- omni-4.0.6/src/appl/omniNames/log.h 2003-05-09 15:32:59.000000000 +0200 +++ omni-4.0.6-patched/src/appl/omniNames/log.h 2005-09-07 11:34:17.000000000 +0200 @@ -104,7 +104,7 @@ class IOError {}; class ParseError {}; - omniNameslog(int& port,char* logdir=0); + omniNameslog(int& port,int removelogs,char* logdir=0); void init(CORBA::ORB_ptr o, PortableServer::POA_ptr p, diff -Naur omni-4.0.6/src/appl/omniNames/omniNames.cc omni-4.0.6-patched/src/appl/omniNames/omniNames.cc --- omni-4.0.6/src/appl/omniNames/omniNames.cc 2003-05-09 15:32:59.000000000 +0200 +++ omni-4.0.6-patched/src/appl/omniNames/omniNames.cc 2005-09-07 11:35:21.000000000 +0200 @@ -123,10 +123,12 @@ int port = 0; char* logdir = 0; int ignoreport = 0; + int removelogs = 0; while (argc > 1) { if (strcmp(argv[1], "-start") == 0) { if (argc < 3 || argv[2][0] == '-') { + removelogs = 1; port = IIOP::DEFAULT_CORBALOC_PORT; removeArgs(argc, argv, 1, 1); } @@ -171,7 +173,7 @@ // number from the log file if "-start" wasn't specified. // - omniNameslog l(port, logdir); + omniNameslog l(port, removelogs, logdir); //