summaryrefslogtreecommitdiffstats
path: root/examples/libsmbclient
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2005-06-01 17:40:40 +0000
committerDerrell Lipman <derrell@samba.org>2005-06-01 17:40:40 +0000
commitec91592e5feef079e3a73cfe4b51b8f8de998e05 (patch)
treef47132c80bc322db052185c3dbf2405a8bbcb607 /examples/libsmbclient
parent15b8d90258d054fcf77fb37b1198d344216505e2 (diff)
downloadsamba-ec91592e5feef079e3a73cfe4b51b8f8de998e05.tar.gz
samba-ec91592e5feef079e3a73cfe4b51b8f8de998e05.tar.xz
samba-ec91592e5feef079e3a73cfe4b51b8f8de998e05.zip
r7168: Updating file times from libsmbclient was not working for win98. Although
the function that was being used to set attributes is a core protocol function (SMBsetatr = 0x09), it does not appear to work on win98. As a temporary measure, when file times are to be set, this version opens the file and uses SMBsetattrE = 0x22 instead. (The other advantage of this function over the original one is that it supports setting access time as well as modification time.) The next step, the proper solution if it can be made to work, is to write functions that use TRANS2_SET_PATH_INFO instead.
Diffstat (limited to 'examples/libsmbclient')
-rw-r--r--examples/libsmbclient/smbwrapper/smbw_stat.c51
1 files changed, 3 insertions, 48 deletions
diff --git a/examples/libsmbclient/smbwrapper/smbw_stat.c b/examples/libsmbclient/smbwrapper/smbw_stat.c
index 70b3064d227..a386c092092 100644
--- a/examples/libsmbclient/smbwrapper/smbw_stat.c
+++ b/examples/libsmbclient/smbwrapper/smbw_stat.c
@@ -22,53 +22,8 @@
#include "smbw.h"
-static int timezone_diff = -1;
-
-#define TM_YEAR_BASE 1900
-
-/*******************************************************************
-yield the difference between *A and *B, in seconds, ignoring leap seconds
-********************************************************************/
-static int tm_diff(struct tm *a, struct tm *b)
-{
- int ay = a->tm_year + (TM_YEAR_BASE - 1);
- int by = b->tm_year + (TM_YEAR_BASE - 1);
- int intervening_leap_days =
- (ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
- int years = ay - by;
- int days = 365*years + intervening_leap_days + (a->tm_yday - b->tm_yday);
- int hours = 24*days + (a->tm_hour - b->tm_hour);
- int minutes = 60*hours + (a->tm_min - b->tm_min);
- int seconds = 60*minutes + (a->tm_sec - b->tm_sec);
-
- return seconds;
-}
-
-/*******************************************************************
- return the UTC offset in seconds west of UTC, or 0 if it cannot be determined
- ******************************************************************/
-static int TimeZone(time_t t)
-{
- struct tm *tm = gmtime(&t);
- struct tm tm_utc;
- if (!tm)
- return 0;
- tm_utc = *tm;
- tm = localtime(&t);
- if (!tm)
- return 0;
- return tm_diff(&tm_utc,tm);
-
-}
-
-
static void copy_stat(struct SMBW_stat *external, struct stat *internal)
{
- if (timezone_diff < 0)
- {
- timezone_diff = TimeZone(time(NULL));
- }
-
external->s_dev = internal->st_dev;
external->s_ino = internal->st_ino;
external->s_mode = internal->st_mode;
@@ -79,9 +34,9 @@ static void copy_stat(struct SMBW_stat *external, struct stat *internal)
external->s_size = internal->st_size;
external->s_blksize = internal->st_blksize;
external->s_blocks = internal->st_blocks;
- external->s_atime = internal->st_atime + timezone_diff;
- external->s_mtime = internal->st_mtime + timezone_diff;
- external->s_ctime = internal->st_ctime + timezone_diff;
+ external->s_atime = internal->st_atime;
+ external->s_mtime = internal->st_mtime;
+ external->s_ctime = internal->st_ctime;
}