Project

General

Profile

Bug #1826 » mod_webdav_POSIX_readdir.patch

Joakim, 2008-11-20 16:07

View differences:

C:/workspace/lighttdpfix/mod_webdav.c (working copy)
1441 1441
		prop_200 = buffer_init();
1442 1442
		prop_404 = buffer_init();
1443 1443

  
1444
		switch(depth) {
1445
		case 0:
1444

  
1446 1445
			/* Depth: 0 */
1447 1446
			webdav_get_props(srv, con, p, &(con->physical), req_props, prop_200, prop_404);
1448 1447

  
......
1481 1480

  
1482 1481
			buffer_append_string_len(b,CONST_STR_LEN("</D:response>\n"));
1483 1482

  
1484
			break;
1485
		case 1:
1483
		if(depth == 1){
1484
		
1486 1485
			if (NULL != (dir = opendir(con->physical.path->ptr))) {
1487 1486
				struct dirent *de;
1488 1487
				physical d;
......
1492 1491
				d.rel_path = buffer_init();
1493 1492

  
1494 1493
				while(NULL != (de = readdir(dir))) {
1495
					if (de->d_name[0] == '.' && de->d_name[1] == '.' && de->d_name[2] == '\0') {
1494
					if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || (de->d_name[1] == '.' && de->d_name[2] == '\0'))) {
1496 1495
						continue;
1497
						/* ignore the parent dir */
1496
						/* ignore the parent and target dir */
1498 1497
					}
1499 1498

  
1500 1499
					buffer_copy_string_buffer(d.path, dst->path);
......
1503 1502
					buffer_copy_string_buffer(d.rel_path, dst->rel_path);
1504 1503
					PATHNAME_APPEND_SLASH(d.rel_path);
1505 1504

  
1506
					if (de->d_name[0] == '.' && de->d_name[1] == '\0') {
1507
						/* don't append the . */
1508
					} else {
1505

  
1506

  
1507

  
1509 1508
						buffer_append_string(d.path, de->d_name);
1510 1509
						buffer_append_string(d.rel_path, de->d_name);
1511
					}
1510
					
1512 1511

  
1513 1512
					buffer_reset(prop_200);
1514 1513
					buffer_reset(prop_404);
......
1554 1553
				buffer_free(d.path);
1555 1554
				buffer_free(d.rel_path);
1556 1555
			}
1557
			break;
1556
			
1558 1557
		}
1559 1558

  
1560 1559
		if (req_props) {
(1-1/2)