From f2b917ca60213534568301074d13a784d68eb2cb Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Mon, 6 Nov 2000 10:01:14 +0000 Subject: [PATCH] Fixed problem with Unix version of _fullpath - can't use cwd if chdir failed. --- src/sbbs3/wrappers.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sbbs3/wrappers.c b/src/sbbs3/wrappers.c index e696060901..7bdbce855c 100644 --- a/src/sbbs3/wrappers.c +++ b/src/sbbs3/wrappers.c @@ -296,9 +296,12 @@ char* _fullpath(char* absPath, const char* relPath, size_t maxLength) } getcwd(curdir, PATH_MAX); - chdir(relPath); - getcwd(absPath, maxLength); - chdir(curdir); + if(chdir(relPath)!=0) /* error, invalid dir */ + strcpy(absPath,relPath); + else { + getcwd(absPath, maxLength); + chdir(curdir); + } free(curdir); return absPath; -- GitLab