Message-ID: <39A2637C.F447CE7E@softhome.net> Date: Tue, 22 Aug 2000 13:26:52 +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 mkdir() Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Another One Patch Bites The Dust... Comments? Laurynas Index: djgpp/src/libc/posix/sys/stat/mkdir.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/mkdir.c,v retrieving revision 1.3 diff -u -p -r1.3 mkdir.c --- mkdir.c 1998/07/12 15:29:20 1.3 +++ mkdir.c 2000/08/22 10:02:44 @@ -1,3 +1,4 @@ +/* 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 */ @@ -10,7 +11,9 @@ #include #include #include +#include #include +#include int mkdir(const char *mydirname, mode_t mode) @@ -18,8 +21,12 @@ mkdir(const char *mydirname, mode_t mode __dpmi_regs r; int use_lfn = _USE_LFN; unsigned attr; + char dir_name[FILENAME_MAX]; - _put_path(mydirname); + if (!__solve_symlinks(mydirname, dir_name)) + return -1; + + _put_path(dir_name); if(use_lfn) r.x.ax = 0x7139; @@ -56,12 +63,12 @@ mkdir(const char *mydirname, mode_t mode } /* mkdir is stub'd, and we don't want to stub chmod also. */ - attr = _chmod(mydirname, 0, 0); + attr = _chmod(dir_name, 0, 0); /* Must clear the directory and volume bits, otherwise 214301 fails. Unused bits left alone (some network redirectors use them). Only care about read-only attribute. */ - if (_chmod(mydirname, 1, (attr & 0xffe6) | ((mode & S_IWUSR) == 0)) == -1) + if (_chmod(dir_name, 1, (attr & 0xffe6) | ((mode & S_IWUSR) == 0)) == -1) return -1; return 0; }