Cleaning up gate and adding comment to flag

This commit is contained in:
Bimba Shrestha 2019-10-25 14:06:50 -07:00
parent 5b45ff4f1c
commit 0b52d878b2
3 changed files with 19 additions and 33 deletions

View File

@ -513,23 +513,17 @@ static FILE* FIO_openSrcFile(const char* srcFileName)
return NULL;
}
#ifdef _MSC_VER
if (!UTIL_isRegularFile(srcFileName)) {
DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n",
srcFileName);
return NULL;
}
#else
if (!UTIL_isRegularFile(srcFileName) && !UTIL_isFIFO(srcFileName)) {
DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n",
srcFileName);
return NULL;
}
if (!UTIL_isRegularFile(srcFileName)
#ifndef _MSC_VER
&& !UTIL_isFIFO(srcFileName)
#endif /* _MSC_VER */
) {
DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n",
srcFileName);
return NULL;
}
{ FILE* const f = fopen(srcFileName, "rb");
if (f == NULL)

View File

@ -115,6 +115,8 @@ int UTIL_isSameFile(const char* file1, const char* file2)
#endif
}
#ifndef _MSC_VER
/* Using this to distinguish named pipes */
U32 UTIL_isFIFO(const char* infilename)
{
/* macro guards, as defined in : https://linux.die.net/man/2/lstat */
@ -126,7 +128,7 @@ U32 UTIL_isFIFO(const char* infilename)
(void)infilename;
return 0;
}
#endif
U32 UTIL_isLink(const char* infilename)
{

View File

@ -992,25 +992,15 @@ int main(int argCount, const char* argv[])
if (!followLinks) {
unsigned u;
for (u=0, fileNamesNb=0; u<filenameIdx; u++) {
#ifdef _MSC_VER
if (UTIL_isLink(filenameTable[u])) {
DISPLAYLEVEL(2, "Warning : %s is a symbolic link, ignoring\n", filenameTable[u]);
} else {
filenameTable[fileNamesNb++] = filenameTable[u];
}
#else
if (UTIL_isLink(filenameTable[u]) && !UTIL_isFIFO(filenameTable[u])) {
DISPLAYLEVEL(2, "Warning : %s is a symbolic link, ignoring\n", filenameTable[u]);
} else {
filenameTable[fileNamesNb++] = filenameTable[u];
}
if (UTIL_isLink(filenameTable[u])
#ifndef _MSC_VER
&& !UTIL_isFIFO(filenameTable[u])
#endif /* _MSC_VER */
) {
DISPLAYLEVEL(2, "Warning : %s is a symbolic link, ignoring\n", filenameTable[u]);
} else {
filenameTable[fileNamesNb++] = filenameTable[u];
}
}
if (fileNamesNb == 0 && filenameIdx > 0)
CLEAN_RETURN(1);