diff options
Diffstat (limited to 'NetWare')
-rw-r--r-- | NetWare/NWUtil.c | 26 | ||||
-rw-r--r-- | NetWare/Nwmain.c | 4 | ||||
-rw-r--r-- | NetWare/Nwpipe.c | 2 | ||||
-rw-r--r-- | NetWare/config.wc | 2 | ||||
-rw-r--r-- | NetWare/config_H.wc | 2 | ||||
-rw-r--r-- | NetWare/nwutil.h | 4 |
6 files changed, 33 insertions, 7 deletions
diff --git a/NetWare/NWUtil.c b/NetWare/NWUtil.c index 9cc5b5c629..ea0e4856ae 100644 --- a/NetWare/NWUtil.c +++ b/NetWare/NWUtil.c @@ -735,6 +735,7 @@ char* fnMy_MkTemp(char* templatestr) char termchar = '\0'; char letter = 'a'; + char letter1 = 'a'; if (templatestr && (pXs = strstr(templatestr, (char *)"XXXXXX"))) @@ -753,6 +754,14 @@ char* fnMy_MkTemp(char* templatestr) else pPid = numbuf; +/** + Backtick operation uses temp files that are stored under DEFPERLTEMP directory. + They are temporarily used and then cleaned up after usage. + In the process of operation to allow for more temp files, the below logic is used. + This allows 26 files (like, pla00015.tmp through plz00015.tmp) plus + 26x26=676 (like, plaa0015.tmp through plzz0015.tmp) +**/ + letter = 'a'; do { @@ -765,6 +774,23 @@ char* fnMy_MkTemp(char* templatestr) letter++; } while (letter <= 'z'); + letter1 = 'a'; + do + { + letter = 'a'; + do + { + sprintf(pXs, (char *)"%c%c%04.5s", letter1, letter, pPid); + pXs[6] = termchar; + if (access(templatestr, 0) != 0) // File does not exist + { + return templatestr; + } + letter++; + } while (letter <= 'z'); + letter1++; + } while (letter1 <= 'z'); + errno = ENOENT; return NULL; } diff --git a/NetWare/Nwmain.c b/NetWare/Nwmain.c index c6cea84438..0e8bf0bbb8 100644 --- a/NetWare/Nwmain.c +++ b/NetWare/Nwmain.c @@ -160,8 +160,8 @@ void main(int argc, char *argv[]) // Ensure that we have a "temp" directory fnSetupNamespace(); - if (access(DEFTEMP, 0) != 0) - mkdir(DEFTEMP); + if (access(DEFPERLTEMP, 0) != 0) + mkdir(DEFPERLTEMP); // Create the file NUL if not present. This is done only once per NLM load. // This is required for -e. diff --git a/NetWare/Nwpipe.c b/NetWare/Nwpipe.c index 2da2b065c3..0deffe5d41 100644 --- a/NetWare/Nwpipe.c +++ b/NetWare/Nwpipe.c @@ -344,7 +344,7 @@ FILE* fnPipeFileOpen(PTEMPPIPEFILE ptpf, char* command, char* mode) // Create a temporary file name // - strncpy ( tempName, fnNwGetEnvironmentStr((char *)"TEMP", DEFTEMP), (_MAX_PATH - 20) ); + strncpy ( tempName, fnNwGetEnvironmentStr((char *)"TEMP", DEFPERLTEMP), (_MAX_PATH - 20) ); tempName[_MAX_PATH-20] = '\0'; strcat(tempName, (char *)"\\plXXXXXX.tmp"); if (!fnMy_MkTemp(tempName)) diff --git a/NetWare/config.wc b/NetWare/config.wc index 9997483e69..ff6d3c90ee 100644 --- a/NetWare/config.wc +++ b/NetWare/config.wc @@ -157,7 +157,7 @@ d_fstatfs='undef' d_fstatvfs='undef' d_ftello='undef' d_ftime='define' -d_getcwd='undef' +d_getcwd='define' d_getfsstat='undef' d_getgrent='undef' d_getgrps='undef' diff --git a/NetWare/config_H.wc b/NetWare/config_H.wc index f10a79811a..b0ddd9e0e4 100644 --- a/NetWare/config_H.wc +++ b/NetWare/config_H.wc @@ -1370,7 +1370,7 @@ * This symbol, if defined, indicates that the getcwd routine is * available to get the current working directory. */ -/*#define HAS_GETCWD /**/ +#define HAS_GETCWD /**/ /* HAS_GETESPWNAM: * This symbol, if defined, indicates that the getespwnam system call is diff --git a/NetWare/nwutil.h b/NetWare/nwutil.h index a2e35ec62e..2d5dd0f067 100644 --- a/NetWare/nwutil.h +++ b/NetWare/nwutil.h @@ -89,10 +89,10 @@ char* fnMy_MkTemp(char* templatestr); */ #define DEFPERLROOT "sys:\\perl\\scripts" -/* DEFTEMP: +/* DEFPERLTEMP: * This symbol contains the name of the default temp files directory. */ -#define DEFTEMP "sys:\\perl\\temp" +#define DEFPERLTEMP "sys:\\perl\\temp" #endif // __NWUtil_H__ |