Bug 4121 - PATH_MAX undefined since it is undefined in limits.h
PATH_MAX undefined since it is undefined in limits.h
Status: NEW
Product: Samba 3.0
Classification: Unclassified
Component: Build environment
x86 Other
: P3 normal
: none
Assigned To: Tim Potter
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2006-09-22 19:45 UTC by Larry Manulak
Modified: 2006-09-25 16:44 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Larry Manulak 2006-09-22 19:45:57 UTC
OS: SCO OpenServer 5.0.7 using gcc 2.95.3p4

client/client.c:3000:'PATH_MAX' undeclared.

This is related to bug 3746.

In SCO OpenServer 5, PATH_MAX is undefined in limits.h. Below is the relevant part of limits.h:
 * The following are not defined since the value can vary according
 * to the file referred to.
 * In all cases, pathconf should be checked to find the actual value for
 * a particular file.
 *  A similar rationale applies to the following cross compatibility values.
 *	MAXPATHLEN		(from 4.2 BSD params.h)

 * It is arguable whether these should be defined even in _IBCS2 mode since
 * the defintions are WRONG on recent SCO OS's and pathconf should be
 * used instead

#ifdef _IBCS2
#define LINK_MAX  1000
#define PATH_MAX   256
#define PIPE_BUF  5120
#endif /* _IBCS2 */

The recommended solution is to use pathconf to find this value. Alternatively, you could use _POSIX_PATH_MAX since that is defined as 255 but that could be too restrictive.

A workaround to get this compiled is:

But then I got 
utils/smbget.c:118:'MAXPATHLEN' undeclared.

As you can see from the part of limits.h extracted above, that is also deliberately undefined.

Adding -DMAXPATHLEN=_POSIX_PATH_MAX would probably work here too but it is time to go home.

Larry Manulak
Omega Computer Services Ltd.
Comment 1 Larry Manulak 2006-09-25 15:25:29 UTC
This seems to be the same as bug 4008 (Compile error in client/client.c when building for SCO OSR 5). I think I have provided additional informatiion about why it happens.
Comment 2 Larry Manulak 2006-09-25 16:44:54 UTC
This appears to be similar to bug 2560 where it showed up in 3.0.13 in smbd/vfs.c and appeared to have been solved by 3.0.14a.

It reappears here in client.c (is that new code?).