summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-27 12:42:39 +0100
committerVolker Lendecke <vl@samba.org>2009-11-29 11:22:01 +0100
commit44ce5603ddbb1b9d75bfff58e40e7f1ea2821c67 (patch)
treebd10abc110d1f33352b102f0d3c0df83c1a88774 /source3/lib
parentb973c5083699ad2b22c72fafe5c4b77f1f4eeccb (diff)
downloadsamba-44ce5603ddbb1b9d75bfff58e40e7f1ea2821c67.tar.gz
samba-44ce5603ddbb1b9d75bfff58e40e7f1ea2821c67.tar.bz2
samba-44ce5603ddbb1b9d75bfff58e40e7f1ea2821c67.zip
s3: Pass the "fake dir create times" parameter to sys_*stat
Step 0 to restore it as a per-share paramter
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/debug.c4
-rw-r--r--source3/lib/sysquotas.c7
-rw-r--r--source3/lib/system.c24
-rw-r--r--source3/lib/util.c8
4 files changed, 25 insertions, 18 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index e851fd20e9..1986d6cfca 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -746,7 +746,9 @@ void check_log_size( void )
maxlog = lp_max_log_size() * 1024;
- if( sys_fstat( x_fileno( dbf ), &st ) == 0 && st.st_ex_size > maxlog ) {
+ if(sys_fstat(x_fileno(dbf), &st,
+ lp_fake_dir_create_times()) == 0
+ && st.st_ex_size > maxlog ) {
(void)reopen_logs();
if( dbf && get_file_size( debugf ) > maxlog ) {
char *name = NULL;
diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c
index 7eed0cadf9..d9bdbf402a 100644
--- a/source3/lib/sysquotas.c
+++ b/source3/lib/sysquotas.c
@@ -60,7 +60,7 @@ static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char
(*bdev) = NULL;
(*fs) = NULL;
- if ( sys_stat(path, &S) == -1 )
+ if ( sys_stat(path, &S, lp_fake_dir_create_times()) == -1 )
return (-1);
devno = S.st_ex_dev ;
@@ -71,7 +71,8 @@ static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char
}
while ((mnt = getmntent(fp))) {
- if ( sys_stat(mnt->mnt_dir,&S) == -1 )
+ if ( sys_stat(mnt->mnt_dir, &S, lp_fake_dir_create_times())
+ == -1 )
continue ;
if (S.st_ex_dev == devno) {
@@ -114,7 +115,7 @@ static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char
/* find the block device file */
- if ((ret=sys_stat(path, &S))!=0) {
+ if ((ret=sys_stat(path, &S, lp_fake_dir_create_times()))!=0) {
return ret;
}
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 8abcb3dc66..86802d0c8d 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -456,9 +456,10 @@ static struct timespec calc_create_time_stat_ex(const struct stat_ex *st)
use the best approximation.
****************************************************************************/
-static void make_create_timespec(const struct stat *pst, struct stat_ex *dst)
+static void make_create_timespec(const struct stat *pst, struct stat_ex *dst,
+ bool fake_dir_create_times)
{
- if (S_ISDIR(pst->st_mode) && lp_fake_dir_create_times()) {
+ if (S_ISDIR(pst->st_mode) && fake_dir_create_times) {
dst->st_ex_btime.tv_sec = 315493200L; /* 1/1/1980 */
dst->st_ex_btime.tv_nsec = 0;
}
@@ -512,7 +513,8 @@ void update_stat_ex_create_time(struct stat_ex *dst,
}
static void init_stat_ex_from_stat (struct stat_ex *dst,
- const struct stat *src)
+ const struct stat *src,
+ bool fake_dir_create_times)
{
dst->st_ex_dev = src->st_dev;
dst->st_ex_ino = src->st_ino;
@@ -525,7 +527,7 @@ static void init_stat_ex_from_stat (struct stat_ex *dst,
dst->st_ex_atime = get_atimespec(src);
dst->st_ex_mtime = get_mtimespec(src);
dst->st_ex_ctime = get_ctimespec(src);
- make_create_timespec(src, dst);
+ make_create_timespec(src, dst, fake_dir_create_times);
dst->st_ex_blksize = src->st_blksize;
dst->st_ex_blocks = src->st_blocks;
@@ -540,7 +542,8 @@ static void init_stat_ex_from_stat (struct stat_ex *dst,
A stat() wrapper that will deal with 64 bit filesizes.
********************************************************************/
-int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
+int sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf,
+ bool fake_dir_create_times)
{
int ret;
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_STAT64)
@@ -554,7 +557,7 @@ int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
if (S_ISDIR(statbuf.st_mode)) {
statbuf.st_size = 0;
}
- init_stat_ex_from_stat(sbuf, &statbuf);
+ init_stat_ex_from_stat(sbuf, &statbuf, fake_dir_create_times);
}
return ret;
}
@@ -563,7 +566,7 @@ int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
An fstat() wrapper that will deal with 64 bit filesizes.
********************************************************************/
-int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf)
+int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf, bool fake_dir_create_times)
{
int ret;
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_FSTAT64)
@@ -577,7 +580,7 @@ int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf)
if (S_ISDIR(statbuf.st_mode)) {
statbuf.st_size = 0;
}
- init_stat_ex_from_stat(sbuf, &statbuf);
+ init_stat_ex_from_stat(sbuf, &statbuf, fake_dir_create_times);
}
return ret;
}
@@ -586,7 +589,8 @@ int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf)
An lstat() wrapper that will deal with 64 bit filesizes.
********************************************************************/
-int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf)
+int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
+ bool fake_dir_create_times)
{
int ret;
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_LSTAT64)
@@ -600,7 +604,7 @@ int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf)
if (S_ISDIR(statbuf.st_mode)) {
statbuf.st_size = 0;
}
- init_stat_ex_from_stat(sbuf, &statbuf);
+ init_stat_ex_from_stat(sbuf, &statbuf, fake_dir_create_times);
}
return ret;
}
diff --git a/source3/lib/util.c b/source3/lib/util.c
index e0b09c4f1f..0351587131 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -533,7 +533,7 @@ bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
if (!sbuf)
sbuf = &st;
- if (sys_stat(fname,sbuf) != 0)
+ if (sys_stat(fname, sbuf, lp_fake_dir_create_times()) != 0)
return(False);
return((S_ISREG(sbuf->st_ex_mode)) || (S_ISFIFO(sbuf->st_ex_mode)));
@@ -546,7 +546,7 @@ bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
bool socket_exist(const char *fname)
{
SMB_STRUCT_STAT st;
- if (sys_stat(fname,&st) != 0)
+ if (sys_stat(fname, &st, lp_fake_dir_create_times()) != 0)
return(False);
return S_ISSOCK(st.st_ex_mode);
@@ -564,7 +564,7 @@ bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st)
if (!st)
st = &st2;
- if (sys_stat(dname,st) != 0)
+ if (sys_stat(dname, st, lp_fake_dir_create_times()) != 0)
return(False);
ret = S_ISDIR(st->st_ex_mode);
@@ -590,7 +590,7 @@ SMB_OFF_T get_file_size(char *file_name)
{
SMB_STRUCT_STAT buf;
buf.st_ex_size = 0;
- if(sys_stat(file_name,&buf) != 0)
+ if (sys_stat(file_name, &buf, lp_fake_dir_create_times()) != 0)
return (SMB_OFF_T)-1;
return get_file_size_stat(&buf);
}