Skip to content

Commit

Permalink
[SSI] Avoid SIGABRT when init fails. Fixes 751
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Jan 30, 2020
1 parent f12981d commit e10bdb9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 38 deletions.
29 changes: 6 additions & 23 deletions src/XrdSsi/XrdSsiSfs.cc
Expand Up @@ -81,18 +81,12 @@
/* V e r s i o n I d e n t i f i c a t i o n */
/******************************************************************************/

XrdVERSIONINFO(XrdSfsGetFileSystem,ssi);
XrdVERSIONINFO(XrdSfsGetFileSystem2,ssi);

/******************************************************************************/
/* G l o b a l O b j e c t s */
/******************************************************************************/

namespace
{
XrdSsiSfsConfig *Config;

};

namespace XrdSsi
{
extern XrdSsiProvider *Provider;
Expand Down Expand Up @@ -128,16 +122,16 @@ int XrdSsiSfs::freeMax = 256;

extern "C"
{
XrdSfsFileSystem *XrdSfsGetFileSystem(XrdSfsFileSystem *nativeFS,
XrdSysLogger *logger,
const char *configFn)
XrdSfsFileSystem *XrdSfsGetFileSystem2(XrdSfsFileSystem *nativeFS,
XrdSysLogger *logger,
const char *configFn,
XrdOucEnv *envP)
{
static XrdSsiSfs mySfs;
static XrdSsiSfsConfig myConfig;

// Set pointer to the config and file system
//
Config = &myConfig;
theFS = nativeFS;
Stats.setFS(nativeFS);

Expand All @@ -150,7 +144,7 @@ XrdSfsFileSystem *XrdSfsGetFileSystem(XrdSfsFileSystem *nativeFS,

// Initialize the subsystems
//
if (!myConfig.Configure(configFn)) return 0;
if (!myConfig.Configure(configFn, envP)) return 0;

// All done, we can return the callout vector to these routines.
//
Expand Down Expand Up @@ -223,17 +217,6 @@ int XrdSsiSfs::Emsg(const char *pfx, // Message prefix value
einfo.setErrInfo(ecode, buffer);
return SFS_ERROR;
}

/******************************************************************************/
/* E n v I n f o */
/******************************************************************************/

void XrdSsiSfs::EnvInfo(XrdOucEnv *envP)
{
if (!envP) Log.Emsg("EnvInfo", "No environmental information passed!");
if (!envP || !Config->Configure(envP)) abort();
}


/******************************************************************************/
/* e x i s t s */
Expand Down
2 changes: 0 additions & 2 deletions src/XrdSsi/XrdSsiSfs.hh
Expand Up @@ -70,8 +70,6 @@ public:
const XrdSecEntity *client,
const char *opaque = 0);

void EnvInfo(XrdOucEnv *envP);

int exists(const char *fileName,
XrdSfsFileExistence &exists_flag,
XrdOucErrInfo &eInfo,
Expand Down
17 changes: 7 additions & 10 deletions src/XrdSsi/XrdSsiSfsConfig.cc
Expand Up @@ -157,7 +157,7 @@ XrdSsiSfsConfig::~XrdSsiSfsConfig()
/* C o n f i g u r e */
/******************************************************************************/

bool XrdSsiSfsConfig::Configure(const char *cFN)
bool XrdSsiSfsConfig::Configure(const char *cFN, XrdOucEnv *envP)
{
char *var;
const char *tmp;
Expand All @@ -167,7 +167,7 @@ bool XrdSsiSfsConfig::Configure(const char *cFN)

// Print warm-up message
//
Log.Say("++++++ ssi phase 1 initialization started.");
Log.Say("++++++ ssi initialization started.");

// Preset all variables with common defaults
//
Expand Down Expand Up @@ -219,10 +219,14 @@ bool XrdSsiSfsConfig::Configure(const char *cFN)
fsChk = FSPath.NotEmpty();
if (isServer && !theFS) fsChk = false;

// Perform historical phase 2 initialization
//
if (!NoGo) NoGo = !Configure(envP);

// All done
//
tmp = (NoGo ? " failed." : " completed.");
Log.Say("------ ssi phase 1 initialization", tmp);
Log.Say("------ ssi initialization", tmp);
return !NoGo;
}

Expand All @@ -233,13 +237,8 @@ bool XrdSsiSfsConfig::Configure(XrdOucEnv *envP)
static char theSSI[] = {'s', 's', 'i', 0};
static char **myArgv = 0, *dfltArgv[] = {0, 0};
XrdOucEnv *xrdEnvP;
const char *tmp;
int myArgc = 0, NoGo;

// Print warm-up message
//
Log.Say("++++++ ssi phase 2 initialization started.");

// Now find the scheduler
//
if (envP && !(Sched = (XrdScheduler *)envP->GetPtr("XrdScheduler*")))
Expand Down Expand Up @@ -280,8 +279,6 @@ bool XrdSsiSfsConfig::Configure(XrdOucEnv *envP)

// All done
//
tmp = (NoGo ? " failed." : " completed.");
Log.Say("------ ssi phase 2 initialization", tmp);
return !NoGo;
}

Expand Down
2 changes: 1 addition & 1 deletion src/XrdSsi/XrdSsiSfsConfig.hh
Expand Up @@ -49,7 +49,7 @@ int myPort;
bool isServer;
bool isCms;

bool Configure(const char *cFN);
bool Configure(const char *cFN, XrdOucEnv *envP);

bool Configure(XrdOucEnv *envP);

Expand Down
3 changes: 1 addition & 2 deletions src/XrdSsi/XrdSsiStat.cc
Expand Up @@ -130,8 +130,7 @@ XrdOssStatInfo2_t XrdOssStatInfoInit2(XrdOss *native_oss,

// Process the configuration file so that we get the service provider object
//
if (!Config.Configure(config_fn) || !Config.Configure(envP))
return 0;
if (!Config.Configure(config_fn, envP)) return 0;

// Return the stat function
//
Expand Down

0 comments on commit e10bdb9

Please sign in to comment.