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

Message-ID: <39A2637C.F447CE7E@softhome.net>
Date: Tue, 22 Aug 2000 13:26:52 +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 mkdir()
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 <fcntl.h>
 #include <io.h>
 #include <dos.h>
+#include <stdio.h>
 #include <libc/dosio.h>
+#include <libc/symlink.h>
  
 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;
 }

- Raw text -


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