]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: Move setting st->st_ino into setup_stat.
authorJeremy Allison <jra@samba.org>
Fri, 18 Oct 2019 16:34:02 +0000 (09:34 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 14 Jan 2020 08:30:23 +0000 (08:30 +0000)
Signed-off-by: Puran Chand <pchand@vmware.com>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 7d3b4f47be0359b496087fc40f89b815c7958dd6)

source3/include/libsmb_internal.h
source3/libsmb/libsmb_stat.c

index 16a5673e4d2caa2c0fe9fce8ff2e9814e0abe3a5..6a58b3306c7239077969013f48f9b8a012ce13ee 100644 (file)
@@ -525,7 +525,8 @@ SMBC_attr_server(TALLOC_CTX *ctx,
 void setup_stat(struct stat *st,
                const char *fname,
                off_t size,
-               int mode);
+               int mode,
+               ino_t ino);
 
 int
 SMBC_stat_ctx(SMBCCTX *context,
index 62d99ce4ba92310e80f504c0cb9633c5dd909226..1bb9e909b15b2cef97a40a22783a82d453c39952 100644 (file)
@@ -48,7 +48,8 @@ static ino_t generate_inode(const char *name)
 void setup_stat(struct stat *st,
                const char *fname,
                off_t size,
-               int mode)
+               int mode,
+               ino_t ino)
 {
        st->st_mode = 0;
 
@@ -90,7 +91,9 @@ void setup_stat(struct stat *st,
                st->st_nlink = 1;
        }
 
-       if (st->st_ino == 0) {
+       if (ino != 0) {
+               st->st_ino = ino;
+       } else {
                st->st_ino = generate_inode(fname);
        }
 }
@@ -177,9 +180,7 @@ SMBC_stat_ctx(SMBCCTX *context,
                return -1;
        }
 
-       st->st_ino = ino;
-
-       setup_stat(st, fname, size, mode);
+       setup_stat(st, fname, size, mode, ino);
 
        st->st_atime = convert_timespec_to_time_t(access_time_ts);
        st->st_ctime = convert_timespec_to_time_t(change_time_ts);
@@ -282,9 +283,7 @@ SMBC_fstat_ctx(SMBCCTX *context,
                write_time_ts = convert_time_t_to_timespec(write_time);
        }
 
-       st->st_ino = ino;
-
-       setup_stat(st, file->fname, size, mode);
+       setup_stat(st, file->fname, size, mode, ino);
 
        st->st_atime = convert_timespec_to_time_t(access_time_ts);
        st->st_ctime = convert_timespec_to_time_t(change_time_ts);