> -----Original Message----- > From: stef...@apache.org [mailto:stef...@apache.org] > Sent: zondag 22 april 2012 21:15 > To: comm...@subversion.apache.org > Subject: svn commit: r1328939 - /subversion/trunk/subversion/libsvn_subr/io.c > > Author: stefan2 > Date: Sun Apr 22 19:14:50 2012 > New Revision: 1328939 > > URL: http://svn.apache.org/viewvc?rev=1328939&view=rev > Log: > * subversion/libsvn_subr/io.c > (svn_io_lock_open_file, svn_io_unlock_open_file): fix handling of APR errors > > Found by: rhuijben > > Modified: > subversion/trunk/subversion/libsvn_subr/io.c > > Modified: subversion/trunk/subversion/libsvn_subr/io.c > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev > =1328939&r1=1328938&r2=1328939&view=diff > ================================================================= > ============= > --- subversion/trunk/subversion/libsvn_subr/io.c (original) > +++ subversion/trunk/subversion/libsvn_subr/io.c Sun Apr 22 19:14:50 2012 > @@ -1883,6 +1883,8 @@ svn_io_lock_open_file(apr_file_t *lockfi > /* We need this only in case of an error but this is cheap to get - > * so we do it here for clarity. */ > apr_err = apr_file_name_get(&fname, lockfile_handle); > + if (apr_err) > + return svn_error_wrap_apr(apr_err, _("Can't get file name")); > > /* Get lock on the filehandle. */ > apr_err = apr_file_lock(lockfile_handle, locktype); > @@ -1909,11 +1911,11 @@ svn_io_lock_open_file(apr_file_t *lockfi > case APR_FLOCK_SHARED: > return svn_error_wrap_apr(apr_err, > _("Can't get shared lock on file '%s'"), > - svn_dirent_local_style(fname, pool)); > + fname);
fname is not guaranteed to be utf-8 here on many platforms. (It is on Windows and OS/X). Before passing it to svn_dirent_local style it must be converted to utf-8 with something like cstring_to_utf8(). > case APR_FLOCK_EXCLUSIVE: > return svn_error_wrap_apr(apr_err, > _("Can't get exclusive lock on file > '%s'"), > - svn_dirent_local_style(fname, pool)); > + fname); Same here. > default: > SVN_ERR_MALFUNCTION(); > } > @@ -1935,22 +1937,26 @@ svn_io_unlock_open_file(apr_file_t *lock > apr_pool_t *pool) > { > const char *fname; > - apr_status_t apr_err = apr_file_unlock(lockfile_handle); > + apr_status_t apr_err; > > /* We need this only in case of an error but this is cheap to get - > * so we do it here for clarity. */ > apr_err = apr_file_name_get(&fname, lockfile_handle); > + if (apr_err) > + return svn_error_wrap_apr(apr_err, _("Can't get file name")); > > + /* The actual unlock attempt. */ > + apr_err = apr_file_unlock(lockfile_handle); > + if (apr_err) > + return svn_error_wrap_apr(apr_err, _("Can't unlock file '%s'"), fname); > + > /* On Windows and OS/2 file locks are automatically released when > the file handle closes */ > #if !defined(WIN32) && !defined(__OS2__) > apr_pool_cleanup_kill(pool, lockfile_handle, file_clear_locks); > #endif > > - return apr_err > - ? svn_error_wrap_apr(apr_err, _("Can't unlock file '%s'"), > - svn_dirent_local_style(fname, pool)) > - : SVN_NO_ERROR; > + return SVN_NO_ERROR; > } > > svn_error_t * >