1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00

Reset the seek pointer to 0 when a file is successfully opened,

since otherwise the initial seek offset will contain the directory
offset of the filesystem block that contained its directory entry.
This bug was mostly harmless because typically the directory is
less than one filesystem block in size so the offset would be zero.
It did however generally break loading a kernel from the (large)
kernel compile directory.

Also reset the seek pointer when a new inode is opened in read_inode(),
though this is not actually necessary now because all callers set
it afterwards.
This commit is contained in:
Ian Dowse 2004-09-04 14:54:01 +00:00
parent 8051b07990
commit e3cce87239
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=134760

View File

@ -191,6 +191,7 @@ read_inode(inumber, f)
fp->f_blkno[level] = -1;
fp->f_buf_blkno = -1;
}
fp->f_seekp = 0;
out:
free(buf);
return (rc);
@ -685,6 +686,7 @@ ufs_open(upath, f)
* Found terminal component.
*/
rc = 0;
fp->f_seekp = 0;
out:
if (buf)
free(buf);