mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Define _DtPLATFORM_MAX_LEN for C libraries (including musl) that do not provide the SVID SYS_NMLN definition. Use sizeof() to replace another #ifdef.
This commit is contained in:
parent
12f2fb1f10
commit
5d5523fd6a
2 changed files with 11 additions and 13 deletions
|
@ -2199,18 +2199,15 @@ int _DtXlateGetXlateEnv(
|
|||
/* then look up version number of execution host */
|
||||
if (ret_AppExecEnvVersion)
|
||||
{
|
||||
#if defined(sun) || defined(_AIX) || defined(__linux__) || defined(CSRG_BASED)
|
||||
char version[SYS_NMLN+SYS_NMLN+2];
|
||||
#else
|
||||
char version[UTSLEN+UTSLEN+2];
|
||||
#endif
|
||||
char version[sizeof(names.release)+sizeof(names.version)-1];
|
||||
char * stdVer = NULL;
|
||||
int verNum = MATCHALL_VER;
|
||||
|
||||
/* cat release version and do a translation on it to a std value */
|
||||
/* then convert the std value to a integer */
|
||||
strcpy(version,names.release);
|
||||
strcat(version,names.version);
|
||||
strncpy(version,names.release,sizeof(names.release)-1);
|
||||
version[sizeof(names.release)-1] = EOS;
|
||||
strncat(version,names.version,sizeof(names.version)-1);
|
||||
ret = _DtXlateOpToStdValue(db,names.sysname,0,
|
||||
_DtXLATE_OPER_VERSION,version,&stdVer,NULL);
|
||||
if (ret == 0)
|
||||
|
|
|
@ -109,14 +109,15 @@ platforms as part of a translation.
|
|||
/*================================================$SKIP$==*/
|
||||
#endif
|
||||
/* $DEF$, Platform constants */
|
||||
#if defined(SVR4) || defined(_AIX)
|
||||
#if defined(SVR4) || defined(_AIX) || defined(SYS_NMLN)
|
||||
#define _DtPLATFORM_MAX_LEN SYS_NMLN
|
||||
#else
|
||||
#if defined(SYS_NMLN)
|
||||
#define _DtPLATFORM_MAX_LEN SYS_NMLN
|
||||
#else
|
||||
#elif defined(UTSLEN)
|
||||
#define _DtPLATFORM_MAX_LEN UTSLEN
|
||||
#endif
|
||||
#else
|
||||
/* POSIX guarantees that hostnames are limited to 255 bytes,
|
||||
* but SVR4 platforms commonly allow for 256.
|
||||
*/
|
||||
#define _DtPLATFORM_MAX_LEN 257
|
||||
#endif
|
||||
|
||||
#define _DtPLATFORM_UNKNOWN ((const char *)0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue