summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-07-09 12:26:56 -0700
committerJeremy Allison <jra@samba.org>2012-07-09 12:26:56 -0700
commit9d5e026bde837ed853478a223e2823fd35c67d26 (patch)
tree0b41a219fcf07d086a52a72cd595bb63406c351c /source3/lib
parent1f37ed7a5283ef3abd095d6a92efa231e7e2444d (diff)
downloadsamba-9d5e026bde837ed853478a223e2823fd35c67d26.tar.gz
samba-9d5e026bde837ed853478a223e2823fd35c67d26.tar.bz2
samba-9d5e026bde837ed853478a223e2823fd35c67d26.zip
Make check_same_stat() and check_same_dev_ino() common functions.
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 697f7b143d..fa46448296 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -126,6 +126,35 @@ uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf)
return sbuf->st_ex_size;
}
+/****************************************************************************
+ Check two stats have identical dev and ino fields.
+****************************************************************************/
+
+bool check_same_dev_ino(const SMB_STRUCT_STAT *sbuf1,
+ const SMB_STRUCT_STAT *sbuf2)
+{
+ if (sbuf1->st_ex_dev != sbuf2->st_ex_dev ||
+ sbuf1->st_ex_ino != sbuf2->st_ex_ino) {
+ return false;
+ }
+ return true;
+}
+
+/****************************************************************************
+ Check if a stat struct is identical for use.
+****************************************************************************/
+
+bool check_same_stat(const SMB_STRUCT_STAT *sbuf1,
+ const SMB_STRUCT_STAT *sbuf2)
+{
+ if (sbuf1->st_ex_uid != sbuf2->st_ex_uid ||
+ sbuf1->st_ex_gid != sbuf2->st_ex_gid ||
+ !check_same_dev_ino(sbuf1, sbuf2)) {
+ return false;
+ }
+ return true;
+}
+
/*******************************************************************
Show a smb message structure.
********************************************************************/