[Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.133,2.134

Guido van Rossum python-dev@python.org
Tue, 2 May 2000 22:44:58 -0400 (EDT)


Update of /projects/cvsroot/python/dist/src/Modules
In directory eric:/projects/python/develop/guido/src/Modules

Modified Files:
	posixmodule.c 
Log Message:
Mark Hammond to the rescue:

Checkin 2.131 of posixmodule.c changed os.stat on Windows, so that
"/bin/" type notation (trailing backslash) would work on Windows to
be consistent with Unix.

However, the patch broke the simple case of: os.stat("\\")

This did work in 1.5.2, and obviously should!

This patch addresses this, and restores the correct behaviour.


Index: posixmodule.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.133
retrieving revision 2.134
diff -C2 -r2.133 -r2.134
*** posixmodule.c	2000/05/01 16:17:24	2.133
--- posixmodule.c	2000/05/03 02:44:55	2.134
***************
*** 568,575 ****
  
  	if ((pathlen > 0) && (path[pathlen-1] == '\\' || path[pathlen-1] == '/')) {
! 		/* exception for drive root */
! 		if (!((pathlen == 3) &&
  		      (path[1] == ':') &&
! 		      (path[2] == '\\' || path[2] == '/')))
  		{
  			strncpy(pathcopy, path, pathlen);
--- 568,576 ----
  
  	if ((pathlen > 0) && (path[pathlen-1] == '\\' || path[pathlen-1] == '/')) {
! 		/* exception for specific or current drive root */
! 		if (!((pathlen == 1) ||
! 		      ((pathlen == 3) &&
  		      (path[1] == ':') &&
! 		      (path[2] == '\\' || path[2] == '/'))))
  		{
  			strncpy(pathcopy, path, pathlen);