* posix/execvp.c: When executing shell on script, first arg is

full file name, not argv[0].

	* mach/Makefile [no_deps]: Inhibit inclusion of mach-syscalls.mk.
	* mach/Machrules [no_deps]: Inhibit interface rules.
This commit is contained in:
Roland McGrath 1996-02-14 06:39:32 +00:00
parent de1b40af73
commit a1c46301bb
4 changed files with 42 additions and 15 deletions

View File

@ -1,5 +1,11 @@
Wed Feb 14 01:08:58 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> Wed Feb 14 01:08:58 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* posix/execvp.c: When executing shell on script, first arg is
full file name, not argv[0].
* mach/Makefile [no_deps]: Inhibit inclusion of mach-syscalls.mk.
* mach/Machrules [no_deps]: Inhibit interface rules.
* malloc/Makefile (distribute): Removed TODO. * malloc/Makefile (distribute): Removed TODO.
Tue Feb 13 05:12:02 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> Tue Feb 13 05:12:02 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>

View File

@ -1,6 +1,6 @@
# Rules for MiG interfaces that want to go into the C library. # Rules for MiG interfaces that want to go into the C library.
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. # Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -58,9 +58,11 @@ define nl # This is needed by *.ir.
endef endef
ifdef user-interfaces ifdef user-interfaces
*.ir := $(addprefix $(objpfx),$(foreach if,$(user-interfaces),$(if).ir)) *.ir := $(addprefix $(objpfx),$(foreach if,$(user-interfaces),$(if).ir))
ifndef no_deps
ifndef inhibit_interface_rules ifndef inhibit_interface_rules
include $(*.ir) include $(*.ir)
endif endif
endif
ifneq "$(*.ir)" "$(wildcard $(*.ir))" ifneq "$(*.ir)" "$(wildcard $(*.ir))"
# If any .ir file is missing, we will be unable to make all the deps. # If any .ir file is missing, we will be unable to make all the deps.
no_deps=t no_deps=t

View File

@ -1,4 +1,4 @@
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. # Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -45,7 +45,7 @@ user-interfaces := $(addprefix mach/,mach_interface mach_port mach_host \
default_pager default_pager_helper \ default_pager default_pager_helper \
)\ )\
$(addprefix device/,device device_request) $(addprefix device/,device device_request)
server-interfaces := mach/exc server-interfaces := mach/exc
tests := hello tests := hello
# It is important that we do not use the wildcard function to expand # It is important that we do not use the wildcard function to expand
# `err_*.sub'. Leaving the wildcard allows Make-dist to find all matching # `err_*.sub'. Leaving the wildcard allows Make-dist to find all matching
@ -98,9 +98,11 @@ install-others += $(includedir)/mach/version.h
$(includedir)/mach/version.h: $(mach-srcdir)/sys/version.h; $(do-install) $(includedir)/mach/version.h: $(mach-srcdir)/sys/version.h; $(do-install)
# Define mach-syscalls and sysno-*. # Define mach-syscalls and sysno-*.
ifndef no_deps
ifndef inhibit_mach_syscalls ifndef inhibit_mach_syscalls
include $(objpfx)mach-syscalls.mk include $(objpfx)mach-syscalls.mk
endif endif
endif
$(objpfx)mach-syscalls.mk: mach/syscall_sw.h syscalls.awk $(objpfx)mach-syscalls.mk: mach/syscall_sw.h syscalls.awk
# Go kludges!!! # Go kludges!!!
sed -n -e '/Unix server implement them/,$$d' \ sed -n -e '/Unix server implement them/,$$d' \

View File

@ -30,6 +30,8 @@ execvp (file, argv)
const char *file; const char *file;
char *const argv[]; char *const argv[];
{ {
int got_eacces = 0;
void execute (const char *file, char *const argv[]) void execute (const char *file, char *const argv[])
{ {
execv (file, argv); execv (file, argv);
@ -39,19 +41,25 @@ execvp (file, argv)
/* The file is accessible but it is not an executable file. /* The file is accessible but it is not an executable file.
Invoke the shell to interpret it as a script. */ Invoke the shell to interpret it as a script. */
int argc;
char **new_argv;
/* Count the arguments. */ /* Count the arguments. */
for (argc = 0; argv[argc++];); int argc = 0;
while (argv[argc++])
;
/* Construct an argument list for the shell. */ /* Construct an argument list for the shell. */
new_argv = __alloca ((argc + 1) * sizeof (char *)); {
for (new_argv[0] = _PATH_BSHELL; argc > 0; --argc) char *new_argv[argc + 1];
new_argv[argc] = argv[argc - 1]; new_argv[0] = (char *) _PATH_BSHELL;
new_argv[1] = (char *) file;
while (argc > 1)
{
new_argv[argc] = argv[argc - 1];
--argc;
}
/* Execute the shell. */ /* Execute the shell. */
execv (new_argv[0], new_argv); execv (new_argv[0], new_argv);
}
} }
} }
@ -102,8 +110,12 @@ execvp (file, argv)
switch (errno) switch (errno)
{ {
case ENOENT:
case EACCES: case EACCES:
/* Record the we got a `Permission denied' error. If we end
up finding no executable we can use, we want to diagnose
that we did find one but were denied access. */
got_eacces = 1;
case ENOENT:
/* Those errors indicate the file is missing or not executable /* Those errors indicate the file is missing or not executable
by us, in which case we want to just try the next path by us, in which case we want to just try the next path
directory. */ directory. */
@ -119,7 +131,12 @@ execvp (file, argv)
while (*p++ != '\0'); while (*p++ != '\0');
} }
/* We tried every element and none of them worked. /* We tried every element and none of them worked. */
Return the error from the last attempt (probably ENOENT). */
if (got_eacces)
/* At least one failure was due to permissions, so report that error. */
errno = EACCES;
/* Return the error from the last attempt (probably ENOENT). */
return -1; return -1;
} }