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 2010/08/17 18:36:47 UTC

svn commit: r986377 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Author: stsp
Date: Tue Aug 17 16:36:47 2010
New Revision: 986377

URL: http://svn.apache.org/viewvc?rev=986377&view=rev
Log:
Slightly improve a probably rarely seen error message in FSFS.

* subversion/libsvn_fs_fs/fs_fs.c
  (check_format_file_buffer_numeric): Make this function receive the entire
   buffer being parsed so it can produce a more helpful error message.
   A new OFFSET argument tells the function where to start looking for digits.
  (read_format): Update caller.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=986377&r1=986376&r2=986377&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Tue Aug 17 16:36:47 2010
@@ -902,21 +902,21 @@ get_file_offset(apr_off_t *offset_p, apr
 }
 
 
-/* Check that BUF, a buffer of text from format file PATH, contains
-   only digits, raising error SVN_ERR_BAD_VERSION_FILE_FORMAT if not.
+/* Check that BUF, a nul-terminated buffer of text from format file PATH,
+   contains only digits at OFFSET and beyond, raising an error if not.
 
    Uses POOL for temporary allocation. */
 static svn_error_t *
-check_format_file_buffer_numeric(const char *buf, const char *path,
-                                 apr_pool_t *pool)
+check_format_file_buffer_numeric(const char *buf, apr_off_t offset,
+                                 const char *path, apr_pool_t *pool)
 {
   const char *p;
 
-  for (p = buf; *p; p++)
+  for (p = buf + offset; *p; p++)
     if (!apr_isdigit(*p))
       return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
-        _("Format file '%s' contains an unexpected non-digit"),
-        svn_dirent_local_style(path, pool));
+        _("Format file '%s' contains unexpected non-digit '%c' within '%s'"),
+        svn_dirent_local_style(path, pool), *p, buf);
 
   return SVN_NO_ERROR;
 }
@@ -970,7 +970,7 @@ read_format(int *pformat, int *max_files
   SVN_ERR(err);
 
   /* Check that the first line contains only digits. */
-  SVN_ERR(check_format_file_buffer_numeric(buf, path, pool));
+  SVN_ERR(check_format_file_buffer_numeric(buf, 0, path, pool));
   *pformat = atoi(buf);
 
   /* Set the default values for anything that can be set via an option. */
@@ -1001,7 +1001,7 @@ read_format(int *pformat, int *max_files
           if (strncmp(buf+7, "sharded ", 8) == 0)
             {
               /* Check that the argument is numeric. */
-              SVN_ERR(check_format_file_buffer_numeric(buf+15, path, pool));
+              SVN_ERR(check_format_file_buffer_numeric(buf, 15, path, pool));
               *max_files_per_dir = atoi(buf+15);
               continue;
             }