AP_FileSystem: avoid aliasing isatty from unistd.h

If some poor sod includes unistd.h in a header included by this then we
get a compilation failure.
This commit is contained in:
Peter Barker 2019-12-05 15:59:24 +11:00 committed by Andrew Tridgell
parent 6d94d2b62f
commit 67aca84adc
1 changed files with 5 additions and 5 deletions

View File

@ -36,7 +36,7 @@ typedef struct {
#define MAX_FILES 16 #define MAX_FILES 16
static FAT_FILE *file_table[MAX_FILES]; static FAT_FILE *file_table[MAX_FILES];
static bool isatty(int fileno) static int isatty_(int fileno)
{ {
if (fileno >= 0 && fileno <= 2) { if (fileno >= 0 && fileno <= 2) {
return true; return true;
@ -54,7 +54,7 @@ static int new_file_descriptor(const char *pathname)
FIL *fh; FIL *fh;
for (i=0; i<MAX_FILES; ++i) { for (i=0; i<MAX_FILES; ++i) {
if (isatty(i)) { if (isatty_(i)) {
continue; continue;
} }
if ( file_table[i] == NULL) { if ( file_table[i] == NULL) {
@ -109,7 +109,7 @@ static int free_file_descriptor(int fileno)
FAT_FILE *stream; FAT_FILE *stream;
FIL *fh; FIL *fh;
if (isatty( fileno )) { if (isatty_( fileno )) {
errno = EBADF; errno = EBADF;
return -1; return -1;
} }
@ -139,7 +139,7 @@ static FIL *fileno_to_fatfs(int fileno)
FAT_FILE *stream; FAT_FILE *stream;
FIL *fh; FIL *fh;
if (isatty( fileno )) { if (isatty_( fileno )) {
errno = EBADF; errno = EBADF;
return nullptr; return nullptr;
} }
@ -486,7 +486,7 @@ off_t AP_Filesystem::lseek(int fileno, off_t position, int whence)
errno = EMFILE; errno = EMFILE;
return -1; return -1;
} }
if (isatty(fileno)) { if (isatty_(fileno)) {
return -1; return -1;
} }