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:
iedowse 2004-09-04 14:54:01 +00:00
parent b5e4a750c3
commit 3233ec4422

View File

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