Fix filename checks

BUG=

Review URL: https://codereview.chromium.org/1160663007

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295430 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/patch.py b/patch.py
index 7dcefc0..1bc608c 100644
--- a/patch.py
+++ b/patch.py
@@ -54,10 +54,15 @@
       if i in filename:
         raise UnsupportedPatchFormat(
             filename, 'Can\'t use \'%s\' in filename.' % i)
-    for i in ('/', 'CON', 'COM'):
-      if filename.startswith(i):
-        raise UnsupportedPatchFormat(
-            filename, 'Filename can\'t start with \'%s\'.' % i)
+    if filename.startswith('/'):
+      raise UnsupportedPatchFormat(
+          filename, 'Filename can\'t start with \'/\'.')
+    if filename == 'CON':
+      raise UnsupportedPatchFormat(
+          filename, 'Filename can\'t be \'CON\'.')
+    if re.match('COM\d', filename):
+      raise UnsupportedPatchFormat(
+          filename, 'Filename can\'t be \'%s\'.' % filename)
     return filename
 
   def set_relpath(self, relpath):