File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -314,8 +314,22 @@ char *path;
314314 DB_RETURN ( path );
315315 }
316316
317+ #if __CYGWIN__
318+ /* Use cygwin function to convert a DOS path to a POSIX path. */
319+ if ( * path && path [1 ] == ':' && isalpha (* path ) ) {
320+ int err = cygwin_conv_path (CCP_WIN_A_TO_POSIX , path , cpath , PATH_MAX );
321+ if (err < 0 )
322+ Fatal ( "error converting \"%s\" - %s\n" ,
323+ path , strerror (errno ));
324+ if ( path [2 ] != '/' && path [2 ] != '\\' )
325+ Warning ("Malformed DOS path %s converted to %s" , path , cpath );
326+ }
327+ else
328+ #endif
329+ {
317330 strcpy ( cpath , path );
318331 Clean_path ( cpath );
332+ }
319333
320334 DB_PRINT ( "path" , ("normalized: %s" , cpath ));
321335
Original file line number Diff line number Diff line change 6666# include <sys/timeb.h>
6767#endif
6868
69- /* for cygdospath()*/
69+ /* for cygwin_conv_path() in Prolog() and for cygdospath()*/
7070#if __CYGWIN__
7171# include <sys/cygwin.h>
7272#endif
@@ -545,9 +545,22 @@ char* argv[];
545545 if ( (CygDrvPre = MALLOC ( PATH_MAX , char )) == NIL (char ) )
546546 No_ram ();
547547 else {
548+ int err = cygwin_conv_path (CCP_WIN_A_TO_POSIX , "c:" , CygDrvPre , PATH_MAX );
549+ if (err < 0 )
550+ Fatal ( "error converting \"%s\" - %s\n" ,
551+ CygDrvPre , strerror (errno ));
552+ if ( (CygDrvPreLen = strlen (CygDrvPre )) == 2 ) {
548553 /* No prefix */
549554 * CygDrvPre = '\0' ;
550555 CygDrvPreLen = 0 ;
556+ } else {
557+ /* Cut away the directory letter. */
558+ CygDrvPre [CygDrvPreLen - 2 ] = '\0' ;
559+ /* Cut away the leading '/'. We don't free the pointer, i.e. choose
560+ * the easy way. */
561+ CygDrvPre ++ ;
562+ CygDrvPreLen -= 3 ;
563+ }
551564 }
552565#endif
553566
@@ -1148,8 +1161,8 @@ cygdospath(char *src, int winpath)/*
11481161
11491162 if ( * src && src [0 ] == '/' ) {
11501163 char * tmp ;
1151- int err = cygwin_conv_to_win32_path ( src , buf );
1152- if (err )
1164+ int err = cygwin_conv_path ( CCP_POSIX_TO_WIN_A , src , buf , PATH_MAX );
1165+ if (err < 0 )
11531166 Fatal ( "error converting \"%s\" - %s\n" ,
11541167 src , strerror (errno ));
11551168
You can’t perform that action at this time.
0 commit comments