Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 26757 invoked from network); 8 Nov 2007 18:48:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Nov 2007 18:48:30 -0000 Received: (qmail 71456 invoked by uid 500); 8 Nov 2007 18:48:17 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 71440 invoked by uid 500); 8 Nov 2007 18:48:17 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 71398 invoked by uid 99); 8 Nov 2007 18:48:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Nov 2007 10:48:16 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Nov 2007 18:49:03 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 19ADE1A9832; Thu, 8 Nov 2007 10:48:06 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r593252 - /harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c Date: Thu, 08 Nov 2007 18:48:05 -0000 To: commits@harmony.apache.org From: ayza@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071108184806.19ADE1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ayza Date: Thu Nov 8 10:48:03 2007 New Revision: 593252 URL: http://svn.apache.org/viewvc?rev=593252&view=rev Log: Handling of names for system devices was imporved. See HARMONY-5064. Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c?rev=593252&r1=593251&r2=593252&view=diff ============================================================================== --- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c (original) +++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c Thu Nov 8 10:48:03 2007 @@ -352,21 +352,25 @@ /** * Determines if the given file name is a reserved device name - * @param[in] fname file name + * @param[in] path the path * @return length of device name if given file name is a device name or * 0 otherwise */ int -is_device_name(const char *fname) +is_device_name(const char *path) { const char *reserved[] = {"con", "prn", "aux", "nul", "com", "lpt"}; - int i, len = strlen(fname); + char *fname = strrchr(path, '\\'); + int i, len; + + fname = fname ? (fname + 1) : (char *) path; + len = strlen(fname); for (i = 0; i < 6; i++) { - if (i < 4 && len >= 3 && !_stricmp(fname + len - 3, reserved[i])) { + if (i < 4 && len == 3 && !_stricmp(fname, reserved[i])) { return 3; - } else if (len >= 4 && !_strnicmp(fname + len - 4, reserved[i], 3) && - isdigit(fname[len - 1])) { + } else if (i >= 4 && len == 4 && !_strnicmp(fname, reserved[i], 3) && + isdigit(fname[3]) && fname[3] != '0') { return 4; } }