- Timestamp:
- Jul 20, 2015, 6:02:55 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_fat32/fat32.c
r637 r638 309 309 static unsigned int _get_inode_from_path( char* pathname, 310 310 fat_inode_t** inode ); 311 312 ////////////////////////////////////////////////////////////////////////////////// 313 // The following function checks if node "a" is an ancestor of inode "b". 314 // It returns 0 on failure. 315 // It returns 1 otherwise. 316 ////////////////////////////////////////////////////////////////////////////////// 317 318 static unsigned int _is_ancestor( fat_inode_t* a, 319 fat_inode_t* b); 311 320 312 321 ////////////////////////////////////////////////////////////////////////////////// … … 1575 1584 } 1576 1585 } // end _add_special_directories 1586 1587 1588 1589 //////////////////////////////////////////////////////////// 1590 static unsigned int _is_ancestor( fat_inode_t* a, 1591 fat_inode_t* b ) 1592 { 1593 while ( b ) 1594 { 1595 if ( a == b ) 1596 return 1; 1597 1598 b = b->parent; 1599 } 1600 1601 return 0; 1602 } // _is_ancestor() 1577 1603 1578 1604 … … 3734 3760 // -10 : "cannot update old_parent directory on device" 3735 3761 // -11 : "cannot remove to_remove node from FS" 3762 // -12 : "cannot move into its own subdirectory" 3736 3763 ///////////////////////////////////////////////////////////////////////////////// 3737 3764 int _fat_rename( char* old_path, … … 3803 3830 _printf("\n[FAT ERROR] in _fat_rename() : <%s> not found\n", new_path ); 3804 3831 return -3; 3832 } 3833 3834 // check for move into own subdirectory 3835 if ( _is_ancestor( old, new_parent ) ) 3836 { 3837 _spin_lock_release( &_fat.fat_lock ); 3838 _printf("\n[FAT ERROR] in _fat_rename() : can't move %s into its own subdirectory\n", old_path ); 3839 return -12; 3805 3840 } 3806 3841
Note: See TracChangeset
for help on using the changeset viewer.