]> err.no Git - linux-2.6/commitdiff
[CIFS] Fix old DOS time conversion to handle timezone
authorSteve French <sfrench@us.ibm.com>
Thu, 12 Oct 2006 00:02:32 +0000 (00:02 +0000)
committerSteve French <sfrench@us.ibm.com>
Thu, 12 Oct 2006 00:02:32 +0000 (00:02 +0000)
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/netmisc.c
fs/cifs/readdir.c

index 3adbd128e08e091e4351c1a0a0ca7cb6107183a4..992e80edc720bb782cc13d5dcb1843691a240adf 100644 (file)
@@ -942,7 +942,7 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
                cERROR(1,("illegal date, month %d day: %d", month, days));
        month -= 1;
        days += total_days_of_prev_months[month];
-       days += 3653; /* account for difference in days between 1980 and 1970 */
+       days += 3652; /* account for difference in days between 1980 and 1970 */
        year = sd->Year;
        days += year * 365;
        days += (year/4); /* leap year */
index 81e7b2e5fb4dc8e9a281649ec83a7a09e6b5a938..80e6ebd440a853b6dc2df1467abd5b6fc7779e6f 100644 (file)
@@ -106,6 +106,17 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
        return rc;
 }
 
+static void AdjustForTZ(struct cifsTconInfo * tcon, struct inode * inode)
+{
+       if((tcon) && (tcon->ses) && (tcon->ses->server)) {
+               inode->i_ctime.tv_sec += tcon->ses->server.timeAdj;
+               inode->i_mtime.tv_sec += tcon->ses->server.timeAdj;
+               inode->i_atime.tv_sec += tcon->ses->server.timeAdj;
+       }
+       return;
+}
+
+
 static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
                char * buf, int *pobject_type, int isNewInode)
 {
@@ -148,7 +159,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
                 tmp_inode->i_ctime = cnvrtDosUnixTm(
                                 le16_to_cpu(pfindData->LastWriteDate),
                                 le16_to_cpu(pfindData->LastWriteTime));
-
+               AdjustForTZ(cifs_sb->tcon, tmp_inode);
                attr = le16_to_cpu(pfindData->Attributes);
                allocation_size = le32_to_cpu(pfindData->AllocationSize);
                end_of_file = le32_to_cpu(pfindData->DataSize);