Commits

Georg Brandl  committed 35c4367

backport patch [ 1119423 ] python -c readlink()s and stat()s '-c'

  • Participants
  • Parent commits 2691cbd
  • Branches 2.4

Comments (0)

Files changed (1)

File Python/sysmodule.c

 		char link[MAXPATHLEN+1];
 		char argv0copy[2*MAXPATHLEN+1];
 		int nr = 0;
-		if (argc > 0 && argv0 != NULL)
+		if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0)
 			nr = readlink(argv0, link, MAXPATHLEN);
 		if (nr > 0) {
 			/* It's a symlink */
 		}
 #endif /* HAVE_READLINK */
 #if SEP == '\\' /* Special case for MS filename syntax */
-		if (argc > 0 && argv0 != NULL) {
+		if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
 			char *q;
 #ifdef MS_WINDOWS
 			char *ptemp;
 			}
 		}
 #else /* All other filename syntaxes */
-		if (argc > 0 && argv0 != NULL) {
+		if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
 #if defined(HAVE_REALPATH)
 			if (realpath(argv0, fullpath)) {
 				argv0 = fullpath;