You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/02/16 10:22:30 UTC

svn commit: r1446858 - /subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c

Author: stefan2
Date: Sat Feb 16 09:22:30 2013
New Revision: 1446858

URL: http://svn.apache.org/r1446858
Log:
On the fsfs-format7 branch:  Fix index access code.  When reading
an index header from an existing stream, make sure we read from
the beginning of the index file and not from some random position.

* subversion/libsvn_fs_fs/index.c
  (get_l2p_header_body,
   get_p2l_page_info): reset stream before reading the header

Modified:
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c?rev=1446858&r1=1446857&r2=1446858&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c Sat Feb 16 09:22:30 2013
@@ -773,6 +773,8 @@ get_l2p_header_body(l2p_header_t **heade
   if (*stream == NULL)
     SVN_ERR(packed_stream_open(stream, path_l2p_index(fs, revision, pool),
                                ffd->block_size, pool));
+  else
+    packed_stream_seek(*stream, 0);
 
   /* read the table sizes */
   SVN_ERR(packed_stream_get(&value, *stream));
@@ -1626,11 +1628,13 @@ get_p2l_page_info(p2l_page_info_baton_t 
     return SVN_NO_ERROR;
 
   /* not found -> must read it from disk.
-   * Open index file */
+   * Open index file or position read pointer to the begin of the file */
   if (*stream == NULL)
     SVN_ERR(packed_stream_open(stream,
                                path_p2l_index(fs, baton->revision, pool),
                                ffd->block_size, pool));
+  else
+    packed_stream_seek(*stream, 0);
 
   /* read table sizes and allocate page array */
   SVN_ERR(packed_stream_get(&value, *stream));