From 36bfaf63485a444d58ca359191377b6694720a37 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 2 Oct 2009 15:48:37 +0200 Subject: DirCreateMode was always zero. work-around now is to do a... one-time write to the mode, then all works. However, if no such write is done, the variable always remains zero. I have used the memory debugger as well as shuffled the code around and used guard variables nothing changed. The problem always moved with the changes I did. So I now consider the one-time write a usable work-around, because it definitely fixes the issue even though it does not explain why it happens. --- tools/omfile.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/omfile.c b/tools/omfile.c index bb12b4b6..c938f18c 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -66,6 +66,7 @@ #include "errmsg.h" #include "stream.h" #include "unicode-helper.h" +#include "atomic.h" MODULE_TYPE_OUTPUT @@ -152,12 +153,14 @@ CODESTARTdbgPrintInstInfo "\tcreate directories: %s\n" "\tfile owner %d, group %d\n" "\tdirectory owner %d, group %d\n" + "\tdir create mode 0%3.3o, file create mode 0%3.3o\n" "\tfail if owner/group can not be set: %s\n", pData->f_fname, pData->iDynaFileCacheSize, pData->bCreateDirs ? "yes" : "no", pData->fileUID, pData->fileGID, pData->dirUID, pData->dirGID, + pData->fDirCreateMode, pData->fCreateMode, pData->bFailOnChown ? "yes" : "no" ); } else { /* regular file */ @@ -615,6 +618,7 @@ ENDdoAction BEGINparseSelectorAct CODESTARTparseSelectorAct +dbgprintf("XXX: dir create mode, enter omfile, 0%3.3o set in action\n", fDirCreateMode); if(!(*p == '$' || *p == '?' || *p == '|' || *p == '/' || *p == '-')) ABORT_FINALIZE(RS_RET_CONFLINE_UNPROCESSED); @@ -676,6 +680,7 @@ CODESTARTparseSelectorAct pData->iDynaFileCacheSize = iDynaFileCacheSize; pData->fCreateMode = fCreateMode; pData->fDirCreateMode = fDirCreateMode; +dbgprintf("XXX: dir create mode 0%3.3o set in action\n", fDirCreateMode); pData->bCreateDirs = bCreateDirs; pData->bFailOnChown = bFailOnChown; pData->fileUID = fileUID; @@ -761,6 +766,8 @@ ENDqueryEtryPt BEGINmodInit(File) CODESTARTmodInit + fDirCreateMode = 0700; /* for some reason, we need to do this write, else the variable always is 0 :S */ + *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); -- cgit