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

nnorwitz@users.sourceforge.net nnorwitz at users.sourceforge.net
Mon Oct 3 03:03:48 CEST 2005


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

Modified Files:
      Tag: release24-maint
	main.c 
Log Message:
Backport:
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.


Index: main.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v
retrieving revision 1.84
retrieving revision 1.84.2.1
diff -u -d -r1.84 -r1.84.2.1
--- main.c	7 Oct 2004 06:46:25 -0000	1.84
+++ main.c	3 Oct 2005 01:03:45 -0000	1.84.2.1
@@ -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