Annotation of pkgsrc/lang/python27/patches/patch-Modules_getpath.c, revision 1.2

1.2     ! spz         1: $NetBSD: patch-Modules_getpath.c,v 1.1 2013/04/17 13:21:05 obache Exp $
1.1       obache      2: 
                      3: * from cygport 2.7.3-getpath-exe-extension.patch
                      4: 
1.2     ! spz         5: --- Modules/getpath.c.orig     2014-06-30 02:05:43.000000000 +0000
1.1       obache      6: +++ Modules/getpath.c
1.2     ! spz         7: @@ -451,6 +451,28 @@ calculate_path(void)
1.1       obache      8:                          if (isxfile(progpath))
                      9:                                  break;
                     10:  
                     11: +#ifdef __CYGWIN__
                     12: +                        /*
                     13: +                         * Cygwin automatically removes the ".exe" extension from argv[0]
                     14: +                         * to make programs feel like they are in a more Unix-like
                     15: +                         * environment.  Unfortunately, this can make it problemmatic for
                     16: +                         * Cygwin to distinguish between a directory and an executable with
                     17: +                         * the same name excluding the ".exe" extension.  For example, the
                     18: +                         * Cygwin Python build directory has a "Python" directory and a
                     19: +                         * "python.exe" executable.  This causes isxfile() to erroneously
                     20: +                         * return false.  If isdir() returns true and there is enough space
                     21: +                         * to append the ".exe" extension, then we try again with the
                     22: +                         * extension appended.
                     23: +                         */
                     24: +#define EXE ".exe"
                     25: +                        if (isdir(progpath) && strlen(progpath) + strlen(EXE) <= MAXPATHLEN)
                     26: +                        {
                     27: +                            strcat(progpath, EXE);
                     28: +                            if (isxfile(progpath))
                     29: +                                break;
                     30: +                        }
                     31: +#endif /* __CYGWIN__ */
                     32: +
                     33:                          if (!delim) {
                     34:                                  progpath[0] = '\0';
                     35:                                  break;

CVSweb <webmaster@jp.NetBSD.org>