mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
AIX does not define NAME_MAX or PATH_MAX by default. It would either
need a special cpp macro like _XPG4 defined or the name buffer would need to be dynamically allocated based on pathconf(), which is undesirably complicated. Instead 255 is used as a suitably sized NAME_MAX and 1024 in place of PATH_MAX.
This commit is contained in:
parent
72c99dbd09
commit
0307846c71
2 changed files with 16 additions and 5 deletions
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dir.c,v 1.3 1999/09/28 03:37:36 tale Exp $ */
|
||||
/* $Id: dir.c,v 1.4 1999/10/01 01:12:04 tale Exp $ */
|
||||
|
||||
/* Principal Authors: DCL */
|
||||
|
||||
|
|
@ -93,7 +93,8 @@ isc_dir_read(isc_dir_t *dir) {
|
|||
/*
|
||||
* Make sure that the space for the name is long enough.
|
||||
*/
|
||||
INSIST(sizeof(dir->entry.name) > strlen(entry->d_name));
|
||||
if (sizeof(dir->entry.name) <= strlen(entry->d_name))
|
||||
return (ISC_R_UNEXPECTED);
|
||||
|
||||
strcpy(dir->entry.name, entry->d_name);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dir.h,v 1.1 1999/09/23 17:31:59 tale Exp $ */
|
||||
/* $Id: dir.h,v 1.2 1999/10/01 01:12:04 tale Exp $ */
|
||||
|
||||
/* Principal Authors: DCL */
|
||||
|
||||
|
|
@ -32,13 +32,23 @@
|
|||
ISC_LANG_BEGINDECLS
|
||||
|
||||
typedef struct {
|
||||
char name[NAME_MAX];
|
||||
/*
|
||||
* Ideally, this should be NAME_MAX, but AIX does not define it by
|
||||
* default and dynamically allocating the space based on pathconf()
|
||||
* complicates things undesirably, as does adding special conditionals
|
||||
* just for AIX. So a comfortably sized buffer is chosen instead.
|
||||
*/
|
||||
char name[256];
|
||||
unsigned int length;
|
||||
} isc_direntry_t;
|
||||
|
||||
typedef struct {
|
||||
int magic;
|
||||
char dirname[PATH_MAX];
|
||||
/*
|
||||
* As with isc_direntry_t->name, making this "right" for all systems
|
||||
* is slightly problematic because AIX does not define PATH_MAX.
|
||||
*/
|
||||
char dirname[1024];
|
||||
isc_direntry_t entry;
|
||||
DIR * handle;
|
||||
} isc_dir_t;
|
||||
|
|
|
|||
Loading…
Reference in a new issue