Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Tue, 14 May 2002 10:44:20 -0400 (EDT) From: Mark Blackburn To: cygwin AT cygwin DOT com Subject: Possible error in cygpath Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In cygpath.cc there is a function that goes like this: static char * get_short_name (const char *filename) { char *sbuf; DWORD len = GetShortPathName (filename, NULL, 0); if (len == ERROR_INVALID_PARAMETER) { fprintf (stderr, "%s: cannot create short name of %s\n", prog_name, filename); exit (2); } sbuf = (char *) malloc (++len); if (sbuf == NULL) { fprintf (stderr, "%s: out of memory\n", prog_name); exit (1); } if (GetShortPathName (filename, sbuf, len) == ERROR_INVALID_PARAMETER) { fprintf (stderr, "%s: cannot create short name of %s\n", prog_name, filename); exit (2); } fprintf(stderr, "get_short_name: sbuf=%s\n",sbuf); return sbuf; } The spot where it says: DWORD len = GetShortPathName (filename, NULL, 0); if (len == ERROR_INVALID_PARAMETER) is what worries me, I think it should be a little more like: DWORD len = GetShortPathName (filename, NULL, 0); if (len == 0 && GetLastError() == ERROR_INVALID_PARAMETER) I don't know how this problem might manifest itself though I suspect that if GetShortPathName returns a length of 87 then bad things might happen ( 87 The parameter is incorrect. ERROR_INVALID_PARAMETER). By the way I noticed this while I was trying to add a -l option to cygpath which is similar to the -s option but it will convert a muddled 8.3 name like PROGRA~1 to "Program Files" and I want to know if anyone else might have been working on that. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/