mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- It is unwise to strip the volume name portion from the path name
used in the GetDeviceProc() loop. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15127 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
checking if the file name includes path separators. If it does not,
|
||||
then the search for the command begins with the resident command list;
|
||||
otherwise the local directories are checked. The new code also properly
|
||||
cleans after itself (a FreeDeviceProc() was missing) and the "PROGDIR:"
|
||||
cleans up after itself (a FreeDeviceProc() was missing) and the "PROGDIR:"
|
||||
lock now always refers to the directory in which the command/script
|
||||
file is found.
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_execve.c,v 1.9 2006-08-13 15:15:11 obarthel Exp $
|
||||
* $Id: unistd_execve.c,v 1.10 2006-08-13 15:35:40 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -304,7 +304,6 @@ find_command(const char * path,struct program_info ** result_ptr)
|
||||
struct name_translation_info nti;
|
||||
struct MsgPort * file_system;
|
||||
struct DevProc * dvp = NULL;
|
||||
STRPTR relative_path;
|
||||
BOOL done = FALSE;
|
||||
LONG io_err;
|
||||
int error = 0;
|
||||
@ -321,17 +320,6 @@ find_command(const char * path,struct program_info ** result_ptr)
|
||||
referring to "C:" gracefully */
|
||||
file_system = GetFileSysTask();
|
||||
|
||||
/* Figure out which part of the path name includes the device
|
||||
or assignment portion, then skip it. This is because the
|
||||
loop below uses GetDeviceProc() to find the file or command,
|
||||
and it starts by changing to the directory the device, volume
|
||||
or assignment in the path name is bound to. */
|
||||
relative_path = (STRPTR)strchr(path,':');
|
||||
if(relative_path != NULL)
|
||||
relative_path++;
|
||||
else
|
||||
relative_path = (STRPTR)path;
|
||||
|
||||
do
|
||||
{
|
||||
/* Give the user a chance to bail out. */
|
||||
@ -350,7 +338,7 @@ find_command(const char * path,struct program_info ** result_ptr)
|
||||
|
||||
/* First try: let's assume that that the file is
|
||||
executable */
|
||||
pi->segment_list = LoadSeg(relative_path);
|
||||
pi->segment_list = LoadSeg((STRPTR)path);
|
||||
if(pi->segment_list != ZERO)
|
||||
{
|
||||
/* Also remember the name of the command */
|
||||
@ -368,7 +356,7 @@ find_command(const char * path,struct program_info ** result_ptr)
|
||||
if(error == 0 && !done && (io_err == ERROR_OBJECT_NOT_FOUND || io_err == ERROR_OBJECT_WRONG_TYPE || io_err == ERROR_BAD_HUNK))
|
||||
{
|
||||
/* Could that be an ARexx or shell script? */
|
||||
if(get_first_script_line(relative_path,&script_line) == 0)
|
||||
if(get_first_script_line((STRPTR)path,&script_line) == 0)
|
||||
{
|
||||
if(strncmp(script_line,"/*",2) == SAME)
|
||||
{
|
||||
@ -436,7 +424,7 @@ find_command(const char * path,struct program_info ** result_ptr)
|
||||
{
|
||||
BPTR file_lock;
|
||||
|
||||
file_lock = Lock(relative_path,SHARED_LOCK);
|
||||
file_lock = Lock((STRPTR)path,SHARED_LOCK);
|
||||
if(file_lock != ZERO)
|
||||
{
|
||||
D_S(struct FileInfoBlock,fib);
|
||||
@ -471,7 +459,7 @@ find_command(const char * path,struct program_info ** result_ptr)
|
||||
|
||||
/* Remember where that file came from so that
|
||||
"PROGDIR:" will work. */
|
||||
file_lock = Lock(relative_path,SHARED_LOCK);
|
||||
file_lock = Lock((STRPTR)path,SHARED_LOCK);
|
||||
if(file_lock != ZERO)
|
||||
{
|
||||
pi->home_dir = ParentDir(file_lock);
|
||||
|
||||
Reference in New Issue
Block a user