You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/02/23 23:14:59 UTC

svn commit: r1073965 - /subversion/trunk/subversion/libsvn_wc/wc_db.c

Author: hwright
Date: Wed Feb 23 22:14:59 2011
New Revision: 1073965

URL: http://svn.apache.org/viewvc?rev=1073965&view=rev
Log:
Followup to r1069978 by similiarly catching errors returned from
parse_local_abspath(), and doing something sensible with them (where possible).

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_temp_set_access, svn_wc__db_temp_clear_access): Catch errors
    and return, rather than potential dereferencing an invalid value.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1073965&r1=1073964&r2=1073965&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Feb 23 22:14:59 2011
@@ -7383,13 +7383,20 @@ svn_wc__db_temp_set_access(svn_wc__db_t 
 {
   const char *local_relpath;
   svn_wc__db_wcroot_t *wcroot;
+  svn_error_t *err;
 
   SVN_ERR_ASSERT_NO_RETURN(svn_dirent_is_absolute(local_dir_abspath));
   /* ### assert that we were passed a directory?  */
 
-  svn_error_clear(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
+  err = svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
                             db, local_dir_abspath, svn_sqlite__mode_readwrite,
-                            scratch_pool, scratch_pool));
+                            scratch_pool, scratch_pool);
+  if (err)
+    {
+      /* We don't even have a wcroot, so just bail. */
+      svn_error_clear(err);
+      return;
+    }
 
   /* Better not override something already there.  */
   SVN_ERR_ASSERT_NO_RETURN(apr_hash_get(wcroot->access_cache,
@@ -7431,13 +7438,19 @@ svn_wc__db_temp_clear_access(svn_wc__db_
 {
   const char *local_relpath;
   svn_wc__db_wcroot_t *wcroot;
+  svn_error_t *err;
 
   SVN_ERR_ASSERT_NO_RETURN(svn_dirent_is_absolute(local_dir_abspath));
   /* ### assert that we were passed a directory?  */
 
-  svn_error_clear(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
+  err = svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
                             db, local_dir_abspath, svn_sqlite__mode_readwrite,
-                            scratch_pool, scratch_pool));
+                            scratch_pool, scratch_pool);
+  if (err)
+    {
+      svn_error_clear(err);
+      return;
+    }
 
   apr_hash_set(wcroot->access_cache, local_dir_abspath,
                APR_HASH_KEY_STRING, NULL);