diff src/fileio.c @ 3648:3e7493e76dc7

[xemacs-hg @ 2006-11-01 20:25:48 by adrian] fix for ffap crash on Windows (was: [Bug: 21.5-b27] [CRASH] (file-name-directory "1:")) -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2006-11-01 Adrian Aichner <adrian@xemacs.org> * sysdep.c (wcslen): Check for NULL pointer. * sysdep.c (strlwr): Ditto. * nt.c (mswindows_getdcwd): Ditto (actual cause of reported crash). * intl-win32.c (wcscmp): Ditto. * intl-win32.c (wcslen): Ditto. * intl-win32.c (wcsncpy): Ditto. * intl-win32.c (wcscpy): Ditto. * intl-win32.c (wcsdup): Ditto. * fileio.c (Ffile_name_directory): Return Qnil when mswindows_getdcwd returns NULL working directory.
author adrian
date Wed, 01 Nov 2006 20:25:50 +0000
parents 305157cf3ebb
children a0adf5f08c44
line wrap: on
line diff
--- a/src/fileio.c	Tue Oct 31 22:51:31 2006 +0000
+++ b/src/fileio.c	Wed Nov 01 20:25:50 2006 +0000
@@ -397,12 +397,21 @@
 
       if (wd)
 	{
+	  int size;
 	  qxestrcat (res, wd);
-	  if (!IS_DIRECTORY_SEP (res[qxestrlen (res) - 1]))
-	    qxestrcat (res, (Ibyte *) "/");
+	  size = qxestrlen (res);
+	  if (!IS_DIRECTORY_SEP (res[size - 1]))
+	    {
+	      res[size] = DIRECTORY_SEP;
+	      res[size + 1] = '\0';
+	    }
 	  beg = res;
 	  p = beg + qxestrlen (beg);
 	}
+      else
+	{
+	  return Qnil;
+	}
       if (wd)
 	xfree (wd, Ibyte *);
     }