href="https://github.com/ewxrjk/rsbackup">rsbackup
in git</a> for detailed change history.</p>
+ <h2>Changes In rsbackup 0.TODO</h2>
+
+ <ul>
+
+ <li><code>--retire</code> no longer fails if a host directory
+ has already been removed.</li>
+
+ </ul>
+
<h2>Changes In rsbackup 0.4.1</h2>
<ul>
-// Copyright © 2011 Richard Kettlewell.
+// Copyright © 2011, 2013 Richard Kettlewell.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
void Directory::open(const std::string &path_) {
if(!(dp = opendir(path_.c_str())))
- throw IOError("opening " + path_);
+ throw IOError("opening " + path_, errno);
path = path_;
}
return true;
} else {
if(errno)
- throw IOError("reading " + path);
+ throw IOError("reading " + path, errno);
return false;
}
}
-// Copyright © 2011 Richard Kettlewell.
+// Copyright © 2011, 2013 Richard Kettlewell.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
}
}
+// Remove all volume directories for a host
static void removeVolumeSubdirectories(Device *device,
const std::string &hostName) {
const std::string hostPath = (device->store->path
+ PATH_SEP + hostName);
- Directory d;
- d.open(hostPath);
- std::string f;
- std::vector<std::string> files;
- while(d.get(f)) {
- if(f != "." && f != "..")
- files.push_back(f);
+ try {
+ Directory d;
+ d.open(hostPath);
+ std::string f;
+ std::vector<std::string> files;
+ while(d.get(f)) {
+ if(f != "." && f != "..")
+ files.push_back(f);
+ }
+ for(size_t n = 0; n < files.size(); ++n)
+ removeDirectory(hostPath + PATH_SEP + files[n]);
+ } catch(IOError &e) {
+ if(e.errno_value == ENOENT) {
+ IO::err.writef("INFO: %s: already removed\n", hostPath.c_str());
+ return;
+ }
+ throw;
}
- for(size_t n = 0; n < files.size(); ++n)
- removeDirectory(hostPath + PATH_SEP + files[n]);
}
// Retire one volume or host