Commit 732fcc10 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added error code CDI_ETMOF (Too many open files)

parent a5ff9ed6
......@@ -5,6 +5,7 @@
2018-05-30 Uwe Schulzweida
* Added error code CDI_ETMOF (Too many open files)
* file.c set default of MAX_FILES to 8192
2018-05-23 Uwe Schulzweida
......
......@@ -201,6 +201,7 @@ bool is_lon_axis(const char *units, const char *stdname)
{
int ioff = 6;
if ( lc_units[ioff] == 's' ) ioff++;
if ( lc_units[ioff] == ' ' ) ioff++;
if ( lc_units[ioff] == '_' ) ioff++;
if ( lc_units[ioff] == 'e' ) status = true;
}
......@@ -229,6 +230,7 @@ bool is_lat_axis(const char *units, const char *stdname)
{
int ioff = 6;
if ( lc_units[ioff] == 's' ) ioff++;
if ( lc_units[ioff] == ' ' ) ioff++;
if ( lc_units[ioff] == '_' ) ioff++;
if ( lc_units[ioff] == 'n' || lc_units[ioff] == 's' ) status = true;
}
......
......@@ -35,6 +35,7 @@ extern "C" {
#define CDI_NOERR 0 // No Error
#define CDI_EEOF -1 // The end of file was encountered
#define CDI_ETMOF -9 // Too many open files
#define CDI_ESYSTEM -10 // Operating system error
#define CDI_EINVAL -20 // Invalid argument
#define CDI_EISDIR -21 // Is a directory
......
......@@ -10,6 +10,7 @@
const char *cdiStringError(int cdiErrno)
{
static const char UnknownError[] = "Unknown Error";
static const char _ETMOF[] = "Too many open files";
static const char _EISDIR[] = "Is a directory";
static const char _EISEMPTY[] = "File is empty";
static const char _EUFTYPE[] = "Unsupported file type";
......@@ -26,6 +27,7 @@ const char *cdiStringError(int cdiErrno)
if ( cp == NULL ) break;
return cp;
}
case CDI_ETMOF: return _ETMOF;
case CDI_EISDIR: return _EISDIR;
case CDI_EISEMPTY: return _EISEMPTY;
case CDI_EUFTYPE: return _EUFTYPE;
......
......@@ -255,7 +255,10 @@ int file_from_pointer(bfile_t *ptr)
Message("Pointer %p has idx %d from file list", ptr, idx);
}
else
Warning("Too many open files (limit is %d)!", _file_max);
{
Warning("Too many open files (limit is %d)!", _file_max);
idx = -2;
}
FILE_UNLOCK();
}
......
......@@ -89,6 +89,7 @@ int cdiGetFiletype(const char *filename, int *byteorder)
else
return CDI_ESYSTEM;
}
else if ( fileID == -2 ) return CDI_ETMOF;
char buffer[8];
if ( fileRead(fileID, buffer, 8) != 8 )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment