]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
logging: create_symlink:sometimes use rel symlinks
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 8 Dec 2010 02:45:21 +0000 (18:45 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 8 Dec 2010 02:45:21 +0000 (18:45 -0800)
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
src/common/DoutStreambuf.cc

index a8a7818feafb200184134acf84d7792b9a62b6c9..77fb9a31f1b5b5c28443040627486786a6b459bf 100644 (file)
@@ -135,8 +135,14 @@ static std::string get_dirname(const std::string &filename)
   return filename.substr(0, last_slash);
 }
 
-static int create_symlink(const string &oldpath, const string &newpath)
+static int create_symlink(string oldpath, const string &newpath)
 {
+  // Create relative symlink if the files are in the same directory
+  if (get_dirname(oldpath) == get_dirname(newpath)) {
+    oldpath = string("./") + get_basename(oldpath);
+    cerr << "setting oldpath = '" << oldpath << "'" << std::endl;
+  }
+
   while (1) {
     if (::symlink(oldpath.c_str(), newpath.c_str()) == 0)
       return 0;