Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jun 2013 01:19:23 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r251561 - head/lib/libstand
Message-ID:  <201306090119.r591JNnx090799@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Sun Jun  9 01:19:22 2013
New Revision: 251561
URL: http://svnweb.freebsd.org/changeset/base/251561

Log:
  libstand: Reset the seek pointer in ext2fs as done in UFS.
  
  Based on r134760:
  
  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.
  
  PR:		177328
  Submitted by:	Eric van Gyzen
  Reviewed by:	iedowse
  MFC after:	5 days

Modified:
  head/lib/libstand/ext2fs.c

Modified: head/lib/libstand/ext2fs.c
==============================================================================
--- head/lib/libstand/ext2fs.c	Sat Jun  8 23:48:13 2013	(r251560)
+++ head/lib/libstand/ext2fs.c	Sun Jun  9 01:19:22 2013	(r251561)
@@ -536,6 +536,7 @@ ext2fs_open(const char *upath, struct op
 	 * Found terminal component.
 	 */
 	error = 0;
+	fp->f_seekp = 0;
 out:
 	if (buf)
 		free(buf);
@@ -584,6 +585,7 @@ read_inode(ino_t inumber, struct open_fi
 	for (level = 0; level < NIADDR; level++)
 		fp->f_blkno[level] = -1;
 	fp->f_buf_blkno = -1;
+	fp->f_seekp = 0;
 
 out:
 	free(buf);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306090119.r591JNnx090799>