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 2011/01/26 21:13:54 UTC
svn commit: r1063861 - /subversion/trunk/subversion/libsvn_client/patch.c
Author: stsp
Date: Wed Jan 26 20:13:53 2011
New Revision: 1063861
URL: http://svn.apache.org/viewvc?rev=1063861&view=rev
Log:
Make svn_client_patch() enforce that the patch source is an existing file.
* subversion/libsvn_client/patch.c
(svn_client_patch): Provide reasonable error messages when the patch
does not exist or is not a file. While here fix stray whitespace.
Modified:
subversion/trunk/subversion/libsvn_client/patch.c
Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1063861&r1=1063860&r2=1063861&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Jan 26 20:13:53 2011
@@ -2746,10 +2746,18 @@ svn_client_patch(const char *patch_abspa
return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
_("'%s' is not a local path"), local_abspath);
+ SVN_ERR(svn_io_check_path(patch_abspath, &kind, scratch_pool));
+ if (kind == svn_node_none)
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' does not exist"), patch_abspath);
+ if (kind != svn_node_file)
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a file"), patch_abspath);
+
SVN_ERR(svn_io_check_path(local_abspath, &kind, scratch_pool));
if (kind == svn_node_none)
return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' does not exist "), local_abspath);
+ _("'%s' does not exist"), local_abspath);
if (kind != svn_node_dir)
return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
_("'%s' is not a directory"), local_abspath);