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

Neil Schemenauer nascheme@users.sourceforge.net
Fri, 22 Mar 2002 12:52:00 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv11061/Modules

Modified Files:
	posixmodule.c 
Log Message:
Handle os.listdir("") case correctly on Windows.  Closes bug 500705.


Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.225
retrieving revision 2.226
diff -C2 -d -r2.225 -r2.226
*** posixmodule.c	12 Mar 2002 21:38:49 -0000	2.225
--- posixmodule.c	22 Mar 2002 20:51:58 -0000	2.226
***************
*** 981,992 ****
  	char *bufptr = namebuf;
  	int len = sizeof(namebuf)/sizeof(namebuf[0]);
- 	char ch;
  
  	if (!PyArg_ParseTuple(args, "et#:listdir",
  	                      Py_FileSystemDefaultEncoding, &bufptr, &len))
  		return NULL;
! 	ch = namebuf[len-1];
! 	if (ch != SEP && ch != ALTSEP && ch != ':')
! 		namebuf[len++] = '/';
  	strcpy(namebuf + len, "*.*");
  
--- 981,993 ----
  	char *bufptr = namebuf;
  	int len = sizeof(namebuf)/sizeof(namebuf[0]);
  
  	if (!PyArg_ParseTuple(args, "et#:listdir",
  	                      Py_FileSystemDefaultEncoding, &bufptr, &len))
  		return NULL;
! 	if (len > 0) {
! 		char ch = namebuf[len-1];
! 		if (ch != SEP && ch != ALTSEP && ch != ':')
! 			namebuf[len++] = '/';
! 	}
  	strcpy(namebuf + len, "*.*");