[omniORB-dev] minor patch for orbOptions::importFromFile
Jon Dyte
jon at totient.demon.co.uk
Tue Mar 30 23:10:36 BST 2004
Hi
I noticed that orbOptions::importFromFile does not log a warning
when the file referred to is not a regular file but say for example
is a directory, in which case it logs "Read from configuration file
<path/to/directory>" and merrily continues on.
I only discovered this after misconfiguring the configure script with the
directory name rather than the full path to the omniORB.cfg file and then
wondering why my settings in omniORB.cfg where not taking effect.
This patch makes the
"Configuration file <filename> either does not exist or is not a file. No
settings read."
message appear in the logging, which I find more helpful.
Jon
*** orbOptionsFile.cc 2003-08-21 15:57:50.000000000 +0100
--- orbOptionsFile.cc 2004-03-24 23:18:31.000000000 +0000
***************
*** 63,68 ****
--- 63,72 ----
#include <stdlib.h>
#include <ctype.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+
#define SUPPORT_OLD_CONFIG_FORMAT 1
OMNI_NAMESPACE_BEGIN(omni)
***************
*** 93,100 ****
unsigned int lnum = 0;
if ( !filename || !strlen(filename) ) return 0;
!
! if ( !(file = fopen(filename, "r")) ) {
if ( omniORB::trace(2) ) {
omniORB::logger log;
log << "Configuration file \"" << filename
--- 97,106 ----
unsigned int lnum = 0;
if ( !filename || !strlen(filename) ) return 0;
! struct stat st;
! if ( (lstat(filename,&st) == -1) ||
! !(S_ISREG(st.st_mode)) ||
! !(file = fopen(filename, "r")) ) {
if ( omniORB::trace(2) ) {
omniORB::logger log;
log << "Configuration file \"" << filename
More information about the omniORB-dev
mailing list