From 05ef0d30bc80976cc46c058b765ff44aa32ebb53 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Sun, 13 Aug 2006 15:35:40 +0000 Subject: [PATCH] - 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 --- library/changes | 2 +- library/unistd_execve.c | 22 +++++----------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/library/changes b/library/changes index addf2e1..804f5c6 100644 --- a/library/changes +++ b/library/changes @@ -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. diff --git a/library/unistd_execve.c b/library/unistd_execve.c index 03f2d2b..d25a58f 100644 --- a/library/unistd_execve.c +++ b/library/unistd_execve.c @@ -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);