summaryrefslogtreecommitdiffstats
path: root/lib/libstand
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2004-09-04 14:54:01 +0000
committeriedowse <iedowse@FreeBSD.org>2004-09-04 14:54:01 +0000
commit3233ec44222cab822d87f357f043eec2301c7980 (patch)
tree15e04ebf08e13b1246df2c020ba5bd1e4a8671bc /lib/libstand
parentb5e4a750c3f4f3cd1429627d30ada60566b715de (diff)
downloadFreeBSD-src-3233ec44222cab822d87f357f043eec2301c7980.zip
FreeBSD-src-3233ec44222cab822d87f357f043eec2301c7980.tar.gz
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.
Diffstat (limited to 'lib/libstand')
-rw-r--r--lib/libstand/ufs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libstand/ufs.c b/lib/libstand/ufs.c
index 6a3d758..169991f 100644
--- a/lib/libstand/ufs.c
+++ b/lib/libstand/ufs.c
@@ -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);
OpenPOWER on IntegriCloud