Changeset View
Changeset View
Standalone View
Standalone View
contrib/file/src/magic.c
Show First 20 Lines • Show All 430 Lines • ▼ Show 20 Lines | #define SLOP (1 + sizeof(union VALUETYPE)) | ||||
} | } | ||||
#ifdef WIN32 | #ifdef WIN32 | ||||
/* Place stdin in binary mode, so EOF (Ctrl+Z) doesn't stop early. */ | /* Place stdin in binary mode, so EOF (Ctrl+Z) doesn't stop early. */ | ||||
if (fd == STDIN_FILENO) | if (fd == STDIN_FILENO) | ||||
_setmode(STDIN_FILENO, O_BINARY); | _setmode(STDIN_FILENO, O_BINARY); | ||||
#endif | #endif | ||||
if (inname != NULL) { | if (inname != NULL) { | ||||
int flags = O_RDONLY|O_BINARY|O_NONBLOCK; | |||||
errno = 0; | errno = 0; | ||||
#ifdef HAVE_CAPSICUM | |||||
if ((fd = fileargs_open(fa, inname)) < 0) { | |||||
#else | |||||
int flags = O_RDONLY|O_BINARY|O_NONBLOCK; | |||||
if ((fd = open(inname, flags)) < 0) { | if ((fd = open(inname, flags)) < 0) { | ||||
#endif | |||||
okstat = stat(inname, &sb) == 0; | okstat = stat(inname, &sb) == 0; | ||||
if (okstat && S_ISFIFO(sb.st_mode)) | if (okstat && S_ISFIFO(sb.st_mode)) | ||||
ispipe = 1; | ispipe = 1; | ||||
#ifdef WIN32 | #ifdef WIN32 | ||||
/* | /* | ||||
* Can't stat, can't open. It may have been opened in | * Can't stat, can't open. It may have been opened in | ||||
* fsmagic, so if the user doesn't have read permission, | * fsmagic, so if the user doesn't have read permission, | ||||
* allow it to say so; otherwise an error was probably | * allow it to say so; otherwise an error was probably | ||||
▲ Show 20 Lines • Show All 205 Lines • Show Last 20 Lines |