[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 200 - trunk/subversion/libsvn_wc

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2001-10-04 16:38:39 CEST

Greg Stein <gstein@lyra.org> writes:

> On Wed, Oct 03, 2001 at 02:38:06PM -0500, sussman@tigris.org wrote:
> >...
> > svn_error_t *
> > svn_wc__save_prop_file (svn_stringbuf_t *propfile_path,
> > apr_hash_t *hash,
> > @@ -284,6 +285,26 @@
> > {
> > apr_status_t apr_err;
> > apr_file_t *prop_tmp;
> > + enum svn_node_kind kind;
> > +
> > + /* Sanity check; if the hash is empty, make sure that *no* propfile
> > + exists! We do this so that svn_wc_props_modified_p() can just
> > + stat the file's existence for quick results (better than opening
> > + and closing an empty file.) */
> > + if (apr_hash_count (hash) == 0)
> > + {
> > + SVN_ERR (svn_io_check_path (propfile_path, &kind, pool));
> > + if (kind == svn_node_file)
> > + {
> > + apr_status_t status = apr_file_remove (propfile_path->data, pool);
> > + if (status)
> > + return svn_error_createf (status, 0, NULL, pool,
> > + "can't delete propfile '%s'",
> > + propfile_path->data);
>
> Euh... you should probably use APR_STATUS_IS_ENOENT() to ignore the case
> where the file isn't there.
>
> Otherwise you could totally barf trying to remove a file that isn't there --
> but that is exactly the state you want! :-)

Huh?

Look at the call right before the apr_file_remove; svn_io_check_path
does exactly that. If the file doesn't exist, it sets kind to
svn_node_none. If the file exists, it sets kind to svn_node_file.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:44 2006

This is an archived mail posted to the Subversion Dev mailing list.