]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- added SDir::stat that stats dirfd directly
authorArvin Schnell <aschnell@suse.de>
Fri, 7 Sep 2012 10:40:28 +0000 (12:40 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 7 Sep 2012 10:40:28 +0000 (12:40 +0200)
snapper/Compare.cc
snapper/FileUtils.cc
snapper/FileUtils.h
snapper/Filesystem.cc

index 4f5555625b3cf00c76529463370390c00c41d9a9..84deeb8b3e5301261e96338e28af595e839d6a50 100644 (file)
@@ -416,7 +416,7 @@ namespace snapper
        y2mil("path1:" << dir1.fullname() << " path2:" << dir2.fullname());
 
        struct stat stat1;
-       int r1 = dir1.stat(".", &stat1, AT_SYMLINK_NOFOLLOW);
+       int r1 = dir1.stat(&stat1);
        if (r1 != 0)
        {
            y2err("stat failed path:" << dir1.fullname() << " errno:" << errno);
@@ -424,7 +424,7 @@ namespace snapper
        }
 
        struct stat stat2;
-       int r2 = dir2.stat(".", &stat2, AT_SYMLINK_NOFOLLOW);
+       int r2 = dir2.stat(&stat2);
        if (r2 != 0)
        {
            y2err("stat failed path:" << dir2.fullname() << " errno:" << errno);
index e2ca1ccb6a48532a036c267b4e83fd491cb9afdc..4e7b0d53a65d94d6f1f0f2a9eb6aa5090b11bf1f 100644 (file)
@@ -187,6 +187,13 @@ namespace snapper
     }
 
 
+    int
+    SDir::stat(struct stat* buf) const
+    {
+       return ::fstat(dirfd, buf);
+    }
+
+
     int
     SDir::stat(const string& name, struct stat* buf, int flags) const
     {
index 1b6c4b3538ee928c1e5222592a3e7ef93f12a5dd..4f8b02427e1e12b90a1ea5051ca1163078fec98c 100644 (file)
@@ -54,6 +54,8 @@ namespace snapper
        vector<string> entries() const;
        vector<string> entries(std::function<bool(unsigned char type, const char* name)> pred) const;
 
+       int stat(struct stat* buf) const;
+
        int stat(const string& name, struct stat* buf, int flags) const;
        int open(const string& name, int flags) const;
        int open(const string& name, int flags, mode_t mode) const;
index 147c27a82cc6c25edb6c9dedd536b0523bebc808..f6d054de761d5a0cf3cdbef4269a8ecfad737a40 100644 (file)
@@ -255,7 +255,7 @@ namespace snapper
        SDir infos_dir(subvolume_dir, ".snapshots");
 
        struct stat stat;
-       if (infos_dir.stat(".", &stat, AT_SYMLINK_NOFOLLOW) != 0)
+       if (infos_dir.stat(&stat) != 0)
        {
            throw IOErrorException();
        }
@@ -689,7 +689,7 @@ namespace snapper
        SDir infos_dir(subvolume_dir, ".snapshots");
 
        struct stat stat;
-       if (infos_dir.stat(".", &stat, AT_SYMLINK_NOFOLLOW) != 0)
+       if (infos_dir.stat(&stat) != 0)
        {
            throw IOErrorException();
        }