mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-23 13:09:58 +08:00
/tmp/T
This commit is contained in:
parent
107116b1c4
commit
2dec9fc459
@ -1,3 +1,8 @@
|
||||
2007-01-13 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* nis/nss_nis/nis-service.c (_nss_nis_getservbyname_r): Correct
|
||||
computation of keylen.
|
||||
|
||||
2007-01-10 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* io/fts.c: Make sure fts_cur is always valid after return from
|
||||
|
9
io/fts.c
9
io/fts.c
@ -376,12 +376,14 @@ fts_read(sp)
|
||||
}
|
||||
p = sp->fts_child;
|
||||
sp->fts_child = NULL;
|
||||
sp->fts_cur = p;
|
||||
goto name;
|
||||
}
|
||||
|
||||
/* Move to the next node on this level. */
|
||||
next: tmp = p;
|
||||
if ((p = p->fts_link) != NULL) {
|
||||
sp->fts_cur = p;
|
||||
free(tmp);
|
||||
|
||||
/*
|
||||
@ -394,7 +396,7 @@ next: tmp = p;
|
||||
return (NULL);
|
||||
}
|
||||
fts_load(sp, p);
|
||||
return (sp->fts_cur = p);
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -420,11 +422,12 @@ next: tmp = p;
|
||||
name: t = sp->fts_path + NAPPEND(p->fts_parent);
|
||||
*t++ = '/';
|
||||
memmove(t, p->fts_name, p->fts_namelen + 1);
|
||||
return (sp->fts_cur = p);
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Move up to the parent node. */
|
||||
p = tmp->fts_parent;
|
||||
sp->fts_cur = p;
|
||||
free(tmp);
|
||||
|
||||
if (p->fts_level == FTS_ROOTPARENTLEVEL) {
|
||||
@ -465,7 +468,7 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent);
|
||||
return (NULL);
|
||||
}
|
||||
p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
|
||||
return (sp->fts_cur = p);
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,3 +1,9 @@
|
||||
2007-01-12 Gwenole Beauchesne <gbeauchesne@mandriva.com>
|
||||
|
||||
[BZ #3884]
|
||||
* locales/sl_SI: Slovenia joined the Euro zone.
|
||||
Fix negative number format.
|
||||
|
||||
2006-11-02 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* locales/mai_IN: New file.
|
||||
|
@ -2126,8 +2126,8 @@ noexpr "<U005E><U005B><U004E><U006E><U005D><U002E><U002A>"
|
||||
END LC_MESSAGES
|
||||
|
||||
LC_MONETARY
|
||||
int_curr_symbol "<U0053><U0049><U0054><U0020>"
|
||||
currency_symbol "<U0053><U0049><U0054>"
|
||||
int_curr_symbol "<U0045><U0055><U0052><U0020>"
|
||||
currency_symbol "<U20AC>"
|
||||
mon_decimal_point "<U002C>"
|
||||
mon_thousands_sep "<U0020>"
|
||||
mon_grouping 3;3
|
||||
@ -2136,11 +2136,11 @@ negative_sign "<U002D>"
|
||||
int_frac_digits 2
|
||||
frac_digits 2
|
||||
p_cs_precedes 0
|
||||
p_sep_by_space 2
|
||||
p_sep_by_space 1
|
||||
n_cs_precedes 0
|
||||
n_sep_by_space 2
|
||||
p_sign_posn 2
|
||||
n_sign_posn 2
|
||||
n_sep_by_space 1
|
||||
p_sign_posn 1
|
||||
n_sign_posn 1
|
||||
END LC_MONETARY
|
||||
|
||||
LC_NUMERIC
|
||||
|
@ -271,7 +271,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
|
||||
|
||||
/* If the protocol is given, we could try if our NIS server knows
|
||||
about services.byservicename map. If yes, we only need one query. */
|
||||
size_t keylen = strlen (name) + 1 + (protocol ? strlen (protocol) : 0);
|
||||
size_t keylen = strlen (name) + (protocol ? 1 + strlen (protocol) : 0);
|
||||
char key[keylen + 1];
|
||||
|
||||
/* key is: "name/proto" */
|
||||
|
@ -83,7 +83,7 @@ tests := tstgetopt testfnm runtests runptests \
|
||||
bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
|
||||
bug-regex25 bug-regex26 tst-nice tst-nanosleep tst-regex2 \
|
||||
transbug tst-rxspencer tst-pcre tst-boost \
|
||||
bug-ga1 tst-vfork1 tst-vfork2 tst-waitid \
|
||||
bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
|
||||
tst-getaddrinfo2 bug-glob1 bug-glob2 tst-sysconf \
|
||||
tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
|
||||
tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
|
||||
@ -108,7 +108,8 @@ generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
|
||||
bug-regex21-mem bug-regex21.mtrace \
|
||||
tst-rxspencer-mem tst-rxspencer.mtrace tst-getconf.out \
|
||||
tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \
|
||||
bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem
|
||||
bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem \
|
||||
tst-vfork3-mem tst-vfork3.mtrace
|
||||
|
||||
include ../Rules
|
||||
|
||||
@ -174,6 +175,7 @@ tst-exec-ARGS = -- $(built-program-cmd)
|
||||
tst-spawn-ARGS = -- $(built-program-cmd)
|
||||
tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir); pwd` $(objpfx)tst-dir
|
||||
tst-chmod-ARGS = `pwd`
|
||||
tst-vfork3-ARGS = --test-dir=$(objpfx)
|
||||
|
||||
tst-fnmatch-ENV = LOCPATH=$(common-objpfx)localedata
|
||||
tst-regexloc-ENV = LOCPATH=$(common-objpfx)localedata
|
||||
@ -218,7 +220,7 @@ ifeq (no,$(cross-compiling))
|
||||
tests: $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \
|
||||
$(objpfx)bug-regex21-mem $(objpfx)tst-rxspencer-mem \
|
||||
$(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out \
|
||||
$(objpfx)bug-glob2-mem
|
||||
$(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem
|
||||
xtests: $(objpfx)bug-ga2-mem
|
||||
endif
|
||||
|
||||
@ -245,6 +247,11 @@ bug-regex21-ENV = MALLOC_TRACE=$(objpfx)bug-regex21.mtrace
|
||||
$(objpfx)bug-regex21-mem: $(objpfx)bug-regex21.out
|
||||
$(common-objpfx)malloc/mtrace $(objpfx)bug-regex21.mtrace > $@
|
||||
|
||||
tst-vfork3-ENV = MALLOC_TRACE=$(objpfx)tst-vfork3.mtrace
|
||||
|
||||
$(objpfx)tst-vfork3-mem: $(objpfx)tst-vfork3.out
|
||||
$(common-objpfx)malloc/mtrace $(objpfx)tst-vfork3.mtrace > $@
|
||||
|
||||
# tst-rxspencer.mtrace is generated only when run without --utf8
|
||||
# option, since otherwise the file has almost 100M and takes very long
|
||||
# time to process.
|
||||
|
101
posix/execvp.c
101
posix/execvp.c
@ -16,6 +16,7 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <alloca.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
@ -27,29 +28,18 @@
|
||||
|
||||
/* The file is accessible but it is not an executable file. Invoke
|
||||
the shell to interpret it as a script. */
|
||||
static char **
|
||||
static void
|
||||
internal_function
|
||||
allocate_scripts_argv (const char *file, char *const argv[])
|
||||
scripts_argv (const char *file, char *const argv[], int argc, char **new_argv)
|
||||
{
|
||||
/* Count the arguments. */
|
||||
int argc = 0;
|
||||
while (argv[argc++])
|
||||
;
|
||||
|
||||
/* Construct an argument list for the shell. */
|
||||
char **new_argv = (char **) malloc ((argc + 1) * sizeof (char *));
|
||||
if (new_argv != NULL)
|
||||
new_argv[0] = (char *) _PATH_BSHELL;
|
||||
new_argv[1] = (char *) file;
|
||||
while (argc > 1)
|
||||
{
|
||||
new_argv[0] = (char *) _PATH_BSHELL;
|
||||
new_argv[1] = (char *) file;
|
||||
while (argc > 1)
|
||||
{
|
||||
new_argv[argc] = argv[argc - 1];
|
||||
--argc;
|
||||
}
|
||||
new_argv[argc] = argv[argc - 1];
|
||||
--argc;
|
||||
}
|
||||
|
||||
return new_argv;
|
||||
}
|
||||
|
||||
|
||||
@ -67,8 +57,6 @@ execvp (file, argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
char **script_argv = NULL;
|
||||
|
||||
if (strchr (file, '/') != NULL)
|
||||
{
|
||||
/* Don't search when it contains a slash. */
|
||||
@ -76,46 +64,71 @@ execvp (file, argv)
|
||||
|
||||
if (errno == ENOEXEC)
|
||||
{
|
||||
script_argv = allocate_scripts_argv (file, argv);
|
||||
/* Count the arguments. */
|
||||
int argc = 0;
|
||||
while (argv[argc++])
|
||||
;
|
||||
size_t len = (argc + 1) * sizeof (char *);
|
||||
char **script_argv;
|
||||
void *ptr = NULL;
|
||||
if (__libc_use_alloca (len))
|
||||
script_argv = alloca (len);
|
||||
else
|
||||
script_argv = ptr = malloc (len);
|
||||
|
||||
if (script_argv != NULL)
|
||||
{
|
||||
scripts_argv (file, argv, argc, script_argv);
|
||||
__execve (script_argv[0], script_argv, __environ);
|
||||
|
||||
free (script_argv);
|
||||
free (ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t pathlen;
|
||||
size_t alloclen = 0;
|
||||
char *path = getenv ("PATH");
|
||||
if (path == NULL)
|
||||
{
|
||||
pathlen = confstr (_CS_PATH, (char *) NULL, 0);
|
||||
alloclen = pathlen + 1;
|
||||
}
|
||||
else
|
||||
pathlen = strlen (path);
|
||||
|
||||
size_t len = strlen (file) + 1;
|
||||
alloclen += pathlen + len + 1;
|
||||
|
||||
char *name;
|
||||
char *path_malloc = NULL;
|
||||
if (__libc_use_alloca (alloclen))
|
||||
name = alloca (alloclen);
|
||||
else
|
||||
{
|
||||
path_malloc = name = malloc (alloclen);
|
||||
if (name == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (path == NULL)
|
||||
{
|
||||
/* There is no `PATH' in the environment.
|
||||
The default search path is the current directory
|
||||
followed by the path `confstr' returns for `_CS_PATH'. */
|
||||
size_t len = confstr (_CS_PATH, (char *) NULL, 0);
|
||||
path = (char *) malloc (1 + len);
|
||||
if (path == NULL)
|
||||
return -1;
|
||||
path = name + pathlen + len + 1;
|
||||
path[0] = ':';
|
||||
(void) confstr (_CS_PATH, path + 1, len);
|
||||
path_malloc = path;
|
||||
(void) confstr (_CS_PATH, path + 1, pathlen);
|
||||
}
|
||||
|
||||
size_t len = strlen (file) + 1;
|
||||
size_t pathlen = strlen (path);
|
||||
char *name = malloc (pathlen + len + 1);
|
||||
if (name == NULL)
|
||||
{
|
||||
free (path_malloc);
|
||||
return -1;
|
||||
}
|
||||
/* Copy the file name at the top. */
|
||||
name = (char *) memcpy (name + pathlen + 1, file, len);
|
||||
/* And add the slash. */
|
||||
*--name = '/';
|
||||
|
||||
char **script_argv = NULL;
|
||||
void *script_argv_malloc = NULL;
|
||||
bool got_eacces = false;
|
||||
char *p = path;
|
||||
do
|
||||
@ -139,7 +152,15 @@ execvp (file, argv)
|
||||
{
|
||||
if (script_argv == NULL)
|
||||
{
|
||||
script_argv = allocate_scripts_argv (startp, argv);
|
||||
/* Count the arguments. */
|
||||
int argc = 0;
|
||||
while (argv[argc++])
|
||||
;
|
||||
size_t arglen = (argc + 1) * sizeof (char *);
|
||||
if (__libc_use_alloca (alloclen + arglen))
|
||||
script_argv = alloca (arglen);
|
||||
else
|
||||
script_argv = script_argv_malloc = malloc (arglen);
|
||||
if (script_argv == NULL)
|
||||
{
|
||||
/* A possible EACCES error is not as important as
|
||||
@ -147,6 +168,7 @@ execvp (file, argv)
|
||||
got_eacces = false;
|
||||
break;
|
||||
}
|
||||
scripts_argv (startp, argv, argc, script_argv);
|
||||
}
|
||||
|
||||
__execve (script_argv[0], script_argv, __environ);
|
||||
@ -184,11 +206,10 @@ execvp (file, argv)
|
||||
/* We tried every element and none of them worked. */
|
||||
if (got_eacces)
|
||||
/* At least one failure was due to permissions, so report that
|
||||
error. */
|
||||
error. */
|
||||
__set_errno (EACCES);
|
||||
|
||||
free (script_argv);
|
||||
free (name - pathlen);
|
||||
free (script_argv_malloc);
|
||||
free (path_malloc);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user