Message-ID: <39A26D38.E560D224@softhome.net> Date: Tue, 22 Aug 2000 14:08:24 +0200 From: Laurynas Biveinis X-Mailer: Mozilla 4.74 [en] (Win98; U) X-Accept-Language: lt,en MIME-Version: 1.0 To: DJGPP Workers Subject: Patch: symlinks in chdir() Content-Type: text/plain; charset=iso-8859-4 Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Again, not much could be said there, except that relinked bash now makes 'cd link' smoothly. Any comments? Laurynas Index: chdir.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/chdir.c,v retrieving revision 1.3 diff -u -r1.3 chdir.c --- chdir.c 1998/12/13 13:09:46 1.3 +++ chdir.c 2000/08/22 12:02:27 @@ -1,13 +1,17 @@ +/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include +#include +#include #include #include #include #include -#include #include +#include +#include #include #include @@ -16,20 +20,26 @@ { __dpmi_regs r; int drv_no = -1; + char real_name[FILENAME_MAX]; + char path[FILENAME_MAX]; - if (mydirname == 0) + if (!__solve_symlinks(mydirname, real_name)) + return -1; + _fixpath(real_name, path); + + if (path == 0) { errno = EINVAL; return -1; } - if (mydirname[0] == 0) + if (path[0] == 0) { errno = ENOENT; return -1; } - _put_path(mydirname); + _put_path(path); /* _put_path performs some magic conversions of file names, so the path in the transfer buffer can include a drive even though