if (dir != NULL) { len = strlen(dir); strncpy(p, dir, buf_len); if (len < buf_len) { p[len++] = LC_PATHDELIM; p += len;
if (dir) {  if (getuid() == geteuid() && getgid() == getegid()) { #if defined(HASSETUGID) priv = issetugid(); #elif defined(HASGETRESUID) { uid_t ruid, euid, suid; gid_t rgid, egid, sgid; if ((getresuid(&ruid, &euid, &suid) == 0) && (getresgid(&rgid, &egid, &sgid) == 0)) priv = (euid != suid) || (egid != sgid); } #else  unsigned int oldeuid; oldeuid = geteuid(); if (seteuid(0) != 0) { priv = 0; } else { seteuid(oldeuid); priv = 1; } #endif } if (!priv) { len = strlen(dir); strncpy(p, dir, buf_len); if (len < buf_len) { p[len++] = LC_PATHDELIM; p += len; }
xlocaledir(    char *buf,    int buf_len){    char *dir, *p = buf;    int len = 0;    dir = getenv("XLOCALEDIR");    if (dir != NULL) {	len = strlen(dir);	strncpy(p, dir, buf_len);	if (len < buf_len) {	    p[len++] = LC_PATHDELIM;	    p += len;	}    }    if (len < buf_len)#ifndef __EMX__      strncpy(p, XLOCALEDIR, buf_len - len);#else      strncpy(p,__XOS2RedirRoot(XLOCALEDIR), buf_len - len);#endif    buf[buf_len-1] = '\0';}