mercurial/osutil.c
changeset 28593 e60c492a0d9b
parent 27970 3d23700cf4a9
child 30098 301ef65e8ebb
equal deleted inserted replaced
28592:cdbd9c0c0775 28593:e60c492a0d9b
   201 	pattern = malloc(plen + 3); /* path + \* + \0 */
   201 	pattern = malloc(plen + 3); /* path + \* + \0 */
   202 	if (!pattern) {
   202 	if (!pattern) {
   203 		PyErr_NoMemory();
   203 		PyErr_NoMemory();
   204 		goto error_nomem;
   204 		goto error_nomem;
   205 	}
   205 	}
   206 	strcpy(pattern, path);
   206 	memcpy(pattern, path, plen);
   207 
   207 
   208 	if (plen > 0) {
   208 	if (plen > 0) {
   209 		char c = path[plen-1];
   209 		char c = path[plen-1];
   210 		if (c != ':' && c != '/' && c != '\\')
   210 		if (c != ':' && c != '/' && c != '\\')
   211 			pattern[plen++] = '\\';
   211 			pattern[plen++] = '\\';
   212 	}
   212 	}
   213 	strcpy(pattern + plen, "*");
   213 	pattern[plen++] = '*';
       
   214 	pattern[plen] = '\0';
   214 
   215 
   215 	fh = FindFirstFileA(pattern, &fd);
   216 	fh = FindFirstFileA(pattern, &fd);
   216 	if (fh == INVALID_HANDLE_VALUE) {
   217 	if (fh == INVALID_HANDLE_VALUE) {
   217 		PyErr_SetFromWindowsErrWithFilename(GetLastError(), path);
   218 		PyErr_SetFromWindowsErrWithFilename(GetLastError(), path);
   218 		goto error_file;
   219 		goto error_file;