Changeset 571 for branches


Ignore:
Timestamp:
Mar 14, 2008, 11:00:26 PM (15 years ago)
Author:
Peter Johansson
Message:

more specific error message when root is not a directory - see ticket:311

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.6-stable/bin/Parameter.cc

    r469 r571  
    128128    string workdir(pwd()); // remember current working directory (cwd).
    129129
     130    bool root_ok = node_exist(root_) && !access_rights(root_, "r");
     131   
     132    if (root_ok) {
     133      // Check that root_ is a directory
     134      struct stat nodestat;
     135      stat(root_.c_str(), &nodestat);
     136      if (!S_ISDIR(nodestat.st_mode))
     137        throw runtime_error(string("svndigest: accessing `") + root_ +
     138                            "': Not a directory.");
     139    }
     140
    130141    // Checking that root_ exists and retrieve the absolute path to root_
    131     if (chdir(root_.c_str()))
     142    if (!root_ok || chdir(root_.c_str()))
    132143      throw runtime_error(string("svndigest: Root directory (") + root_ +
    133144                          ") access failed.");
    134145    root_ = pwd();
     146
     147     
    135148
    136149    // need to get back to cwd if relative paths are used.
Note: See TracChangeset for help on using the changeset viewer.