delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/08/22/08:05:42

Message-ID: <39A26D38.E560D224@softhome.net>
Date: Tue, 22 Aug 2000 14:08:24 +0200
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.74 [en] (Win98; U)
X-Accept-Language: lt,en
MIME-Version: 1.0
To: DJGPP Workers <djgpp-workers AT delorie DOT com>
Subject: Patch: symlinks in chdir()
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 <libc/stubs.h>
+#include <libc/symlink.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <go32.h>
-#include <ctype.h>
 #include <dpmi.h>
+#include <stdio.h>
+#include <limits.h>
 #include <libc/dosio.h>
 #include <libc/farptrgs.h>
 
@@ -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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019