[PATCH] Linux 2.2.14pre16 & bugfix for ncpfs and vfat

Wolfram Pienkoss (wp@bsz.shk.th.schule.de)
Tue, 21 Dec 1999 20:38:36 +0100 (CET)


Hi,

the patch below fixes a bug in ncpfs. The modify time of files, copied
to a mounted NetWare directory with 'cp -av' or 'Midnight Commander'
will not updated to the modify time of the origin files. Only after an
umount and a following mount the times are correct.

If fixes also a bug in vfat for the mount option 'uni_xlate'. It causes
the error message 'invalid argument' sometimes, if we try an
access to filenames contain vfat escape sequences. The reason is a
possible reading beyond the end of string in the function xlate_to_uni.

Both bugs are fixed in kernel 2.3.34. The fix is tested since a long time.

Best regards,
Wolfram

diff -urdN linux-2.2.14-pre16/fs/ncpfs/inode.c linux/fs/ncpfs/inode.c
--- linux-2.2.14-pre16/fs/ncpfs/inode.c Fri May 14 19:43:13 1999
+++ linux/fs/ncpfs/inode.c Tue Dec 21 19:14:47 1999
@@ -134,10 +134,16 @@
if ((inode->i_size)&&(inode->i_blksize)) {
inode->i_blocks = (inode->i_size-1)/(inode->i_blksize)+1;
}
- /* TODO: times? I'm not sure... */
- NCP_FINFO(inode)->DosDirNum = nwinfo->i.DosDirNum;
- NCP_FINFO(inode)->dirEntNum = nwinfo->i.dirEntNum;
- NCP_FINFO(inode)->volNumber = nwinfo->i.volNumber;
+
+ inode->i_mtime = ncp_date_dos2unix(le16_to_cpu(nwi->modifyTime),
+ le16_to_cpu(nwi->modifyDate));
+ inode->i_ctime = ncp_date_dos2unix(le16_to_cpu(nwi->creationTime),
+ le16_to_cpu(nwi->creationDate));
+ inode->i_atime = ncp_date_dos2unix(0, le16_to_cpu(nwi->lastAccessDate));
+
+ NCP_FINFO(inode)->DosDirNum = nwi->DosDirNum;
+ NCP_FINFO(inode)->dirEntNum = nwi->dirEntNum;
+ NCP_FINFO(inode)->volNumber = nwi->volNumber;
}

/*
diff -urdN linux-2.2.14-pre16/fs/vfat/namei.c linux/fs/vfat/namei.c
--- linux-2.2.14-pre16/fs/vfat/namei.c Tue Dec 21 17:51:24 1999
+++ linux/fs/vfat/namei.c Tue Dec 21 18:40:13 1999
@@ -661,7 +661,7 @@
op = outname;
if (nls) {
for (i = 0, ip = name, op = outname, *outlen = 0;
- i < len && *outlen <= 260; i++, *outlen += 1)
+ i < len && *outlen <= 260; *outlen += 1)
{
if (escape && (*ip == ':')) {
if (i > len - 4) return -EINVAL;
@@ -673,10 +673,12 @@
*op++ = (c1 << 4) + (c2 >> 2);
*op++ = ((c2 & 0x3) << 6) + c3;
ip += 4;
+ i += 4;
} else {
*op++ = nls->charset2uni[*ip].uni1;
*op++ = nls->charset2uni[*ip].uni2;
ip++;
+ i++;
}
}
} else {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/