* environ.cc (build_env): Don't put an empty environment variable into the
environment. Optimize use of "len". * errno.cc (ERROR_MORE_DATA): Translate to EMSGSIZE rather than EAGAIN.
This commit is contained in:
parent
0324070e35
commit
d6b1ac7faa
|
@ -1,3 +1,9 @@
|
||||||
|
2006-09-07 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* environ.cc (build_env): Don't put an empty environment variable into
|
||||||
|
the environment. Optimize use of "len".
|
||||||
|
* errno.cc (ERROR_MORE_DATA): Translate to EMSGSIZE rather than EAGAIN.
|
||||||
|
|
||||||
2006-08-31 Corinna Vinschen <corinna@vinschen.de>
|
2006-08-31 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* grp.cc (initgroups32): Run get_server_groups under original token.
|
* grp.cc (initgroups32): Run get_server_groups under original token.
|
||||||
|
|
|
@ -1064,30 +1064,31 @@ build_env (const char * const *envp, char *&envblock, int &envc,
|
||||||
const char *p;
|
const char *p;
|
||||||
win_env *conv;
|
win_env *conv;
|
||||||
len = strcspn (*srcp, "=") + 1;
|
len = strcspn (*srcp, "=") + 1;
|
||||||
|
const char *rest = *srcp + len;
|
||||||
|
|
||||||
/* Check for a bad entry. This is necessary to get rid of empty
|
/* Check for a bad entry. This is necessary to get rid of empty
|
||||||
strings, induced by putenv and changing the string afterwards.
|
strings, induced by putenv and changing the string afterwards.
|
||||||
Note that this doesn't stop invalid strings without '=' in it
|
Note that this doesn't stop invalid strings without '=' in it
|
||||||
etc., but we're opting for speed here for now. Adding complete
|
etc., but we're opting for speed here for now. Adding complete
|
||||||
checking would be pretty expensive. */
|
checking would be pretty expensive. */
|
||||||
if (len == 1)
|
if (len == 1 || !*rest)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* See if this entry requires posix->win32 conversion. */
|
/* See if this entry requires posix->win32 conversion. */
|
||||||
conv = getwinenv (*srcp, *srcp + len, &temp);
|
conv = getwinenv (*srcp, rest, &temp);
|
||||||
if (conv)
|
if (conv)
|
||||||
p = conv->native; /* Use win32 path */
|
p = conv->native; /* Use win32 path */
|
||||||
else
|
else
|
||||||
p = *srcp; /* Don't worry about it */
|
p = *srcp; /* Don't worry about it */
|
||||||
|
|
||||||
len = strlen (p);
|
len = strlen (p) + 1;
|
||||||
if (len >= 32 * 1024)
|
if (len >= 32 * 1024)
|
||||||
{
|
{
|
||||||
free (envblock);
|
free (envblock);
|
||||||
envblock = NULL;
|
envblock = NULL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
new_tl += len + 1; /* Keep running total of block length so far */
|
new_tl += len; /* Keep running total of block length so far */
|
||||||
|
|
||||||
/* See if we need to increase the size of the block. */
|
/* See if we need to increase the size of the block. */
|
||||||
if (new_tl > tl)
|
if (new_tl > tl)
|
||||||
|
@ -1103,7 +1104,7 @@ build_env (const char * const *envp, char *&envblock, int &envc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy (s, p, len + 1);
|
memcpy (s, p, len);
|
||||||
|
|
||||||
/* See if environment variable is "special" in a Windows sense.
|
/* See if environment variable is "special" in a Windows sense.
|
||||||
Under NT, the current directories for visited drives are stored
|
Under NT, the current directories for visited drives are stored
|
||||||
|
@ -1112,7 +1113,7 @@ build_env (const char * const *envp, char *&envblock, int &envc,
|
||||||
if (s[0] == '!' && (isdrive (s + 1) || (s[1] == ':' && s[2] == ':'))
|
if (s[0] == '!' && (isdrive (s + 1) || (s[1] == ':' && s[2] == ':'))
|
||||||
&& s[3] == '=')
|
&& s[3] == '=')
|
||||||
*s = '=';
|
*s = '=';
|
||||||
s += len + 1;
|
s += len;
|
||||||
}
|
}
|
||||||
*s = '\0'; /* Two null bytes at the end */
|
*s = '\0'; /* Two null bytes at the end */
|
||||||
assert ((s - envblock) <= tl); /* Detect if we somehow ran over end
|
assert ((s - envblock) <= tl); /* Detect if we somehow ran over end
|
||||||
|
|
|
@ -87,7 +87,7 @@ static NO_COPY struct
|
||||||
X (MAX_THRDS_REACHED, EAGAIN),
|
X (MAX_THRDS_REACHED, EAGAIN),
|
||||||
X (META_EXPANSION_TOO_LONG, EINVAL),
|
X (META_EXPANSION_TOO_LONG, EINVAL),
|
||||||
X (MOD_NOT_FOUND, ENOENT),
|
X (MOD_NOT_FOUND, ENOENT),
|
||||||
X (MORE_DATA, EAGAIN),
|
X (MORE_DATA, EMSGSIZE),
|
||||||
X (NEGATIVE_SEEK, EINVAL),
|
X (NEGATIVE_SEEK, EINVAL),
|
||||||
X (NETNAME_DELETED, ENOSHARE),
|
X (NETNAME_DELETED, ENOSHARE),
|
||||||
X (NOACCESS, EFAULT),
|
X (NOACCESS, EFAULT),
|
||||||
|
|
Loading…
Reference in New Issue