Changeset 51 for trunk/bin


Ignore:
Timestamp:
Jan 15, 2006, 1:38:12 AM (16 years ago)
Author:
Jari Häkkinen
Message:

Clean up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/rmdirhier.cc

    r49 r51  
    4747
    4848   // Delete any remaining directory entries
    49     DIR *dirp;
     49    DIR* dp;
    5050    struct dirent *entry;
    51     if (!(dirp = opendir(".")))
     51    if (!(dp=opendir(".")))
    5252      throw DirectoryOpenError(dir);
    53     while ((entry = readdir(dirp)) != NULL) {
    54       struct stat finfo;
     53    while ((entry=readdir(dp)) != NULL) {
     54      struct stat buf;
    5555      if (entry->d_name[0] == '.')
    5656        continue;
    57       stat(entry->d_name,&finfo);
    58       if (finfo.st_mode & S_IFDIR)
     57      stat(entry->d_name,&buf);
     58      if (buf.st_mode & S_IFDIR)
    5959        rmdirhier__(entry->d_name);      // sub-directory
    6060      else {
    61         // Enable delete of file, then do it
     61        // Make sure file is removable before removing it
    6262        chmod(entry->d_name,S_IWRITE);
    6363        if (unlink(entry->d_name))
     
    6565      }
    6666    }
    67     closedir(dirp);
     67    closedir(dp);
    6868
    6969    // Remove the directory from its parent
Note: See TracChangeset for help on using the changeset viewer.