removed regular file test on Windows
since it does not work well on this platform (tested with MinGW). Note : could be an issue within UTIL_isRegularFile()
This commit is contained in:
@@ -538,6 +538,8 @@ static FILE* FIO_openSrcFile(const char* srcFileName)
|
|||||||
* @result : FILE* to `dstFileName`, or NULL if it fails */
|
* @result : FILE* to `dstFileName`, or NULL if it fails */
|
||||||
static FILE* FIO_openDstFile(FIO_prefs_t* const prefs, const char* srcFileName, const char* dstFileName)
|
static FILE* FIO_openDstFile(FIO_prefs_t* const prefs, const char* srcFileName, const char* dstFileName)
|
||||||
{
|
{
|
||||||
|
if (prefs->testMode) return NULL; /* do not open file in test mode */
|
||||||
|
|
||||||
assert(dstFileName != NULL);
|
assert(dstFileName != NULL);
|
||||||
if (!strcmp (dstFileName, stdoutmark)) {
|
if (!strcmp (dstFileName, stdoutmark)) {
|
||||||
DISPLAYLEVEL(4,"Using stdout for output \n");
|
DISPLAYLEVEL(4,"Using stdout for output \n");
|
||||||
@@ -562,10 +564,14 @@ static FILE* FIO_openDstFile(FIO_prefs_t* const prefs, const char* srcFileName,
|
|||||||
if (UTIL_isRegularFile(dstFileName)) {
|
if (UTIL_isRegularFile(dstFileName)) {
|
||||||
/* Check if destination file already exists */
|
/* Check if destination file already exists */
|
||||||
FILE* const fCheck = fopen( dstFileName, "rb" );
|
FILE* const fCheck = fopen( dstFileName, "rb" );
|
||||||
|
#if !defined(_WIN32)
|
||||||
|
/* this test does not work on Windows :
|
||||||
|
* `NUL` and `nul` are detected as regular files */
|
||||||
if (!strcmp(dstFileName, nulmark)) {
|
if (!strcmp(dstFileName, nulmark)) {
|
||||||
EXM_THROW(40, "%s is unexpectedly categorized as a regular file",
|
EXM_THROW(40, "%s is unexpectedly categorized as a regular file",
|
||||||
dstFileName);
|
dstFileName);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (fCheck != NULL) { /* dst file exists, authorization prompt */
|
if (fCheck != NULL) { /* dst file exists, authorization prompt */
|
||||||
fclose(fCheck);
|
fclose(fCheck);
|
||||||
if (!prefs->overwrite) {
|
if (!prefs->overwrite) {
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ extern "C" {
|
|||||||
#define stdinmark "/*stdin*\\"
|
#define stdinmark "/*stdin*\\"
|
||||||
#define stdoutmark "/*stdout*\\"
|
#define stdoutmark "/*stdout*\\"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define nulmark "nul"
|
# define nulmark "NUL"
|
||||||
#else
|
#else
|
||||||
# define nulmark "/dev/null"
|
# define nulmark "/dev/null"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user