[Python-checkins] python/dist/src/Modules main.c,1.84,1.85

nnorwitz@users.sourceforge.net nnorwitz at users.sourceforge.net
Mon Oct 3 02:55:00 CEST 2005


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15556/Modules

Modified Files:
	main.c 
Log Message:
SF bug #887946, segfault if redirecting directory
Also provide a warning if a directory is passed on the command line.
Add minimal command line test.

Will backport.


Index: main.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- main.c	7 Oct 2004 06:46:25 -0000	1.84
+++ main.c	3 Oct 2005 00:54:57 -0000	1.85
@@ -359,6 +359,14 @@
 					}
 				}
 			}
+			{
+				/* XXX: does this work on Win/Win64? (see posix_fstat) */
+				struct stat sb;
+				if (fstat(fileno(fp), &sb) == 0 &&
+				    S_ISDIR(sb.st_mode)) {
+					fprintf(stderr, "%s: warning '%s' is a directory\n", argv[0], filename);
+				}
+			}
 		}
 	}
 



More information about the Python-checkins mailing list