Date: Tue, 18 Nov 1997 10:54:59 +0200 (IST) From: Eli Zaretskii To: "X DOT PONS AT UAB DOT ES" cc: djgpp AT delorie DOT com Subject: Re: system calls generate Segm.Viol. on NT In-Reply-To: <01IQ4NN88GG200LLZ6@cc.uab.es> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Mon, 17 Nov 1997, X DOT PONS AT UAB DOT ES wrote: > If the command line is "dir c:\\" instead of "dir c:\\ > c:\\somefile.txt" > it also crashes, so the redirector '>' does not seem the > responsible. You are obviously assuming that the call to `system' is the culprit. Why do you think so? Your traceback explicitely points to the call to `putchar', so the program is past the call to `system', it's in this loop: while ((c=getc(pf))!=EOF) putchar(c); > 3/ The symify help for the output is as follows. > > Exiting due to signal SIGSEGV > General Protection Fault at eip=00003b94 > eax=fff40000 ebx=00000000 ecx=000001f9 edx=fff40000 esi=00004000 edi=0000000b > ebp=00053070 esp=00053060 cs=01cf ds=01d7 es=01d7 fs=019f gs=01df ss=01d7 > Call frame traceback EIPs: > 0x00003b94 _malloc+308 > 0x00003b11 _malloc+177 > 0x000079b7 __flsbuf+159 > 0x00002a4d _putchar+25 > 0x000015fc _main+108 > 0x00001b47 ___crt1_startup+115 This traceback indicates that you are using DJGPP v2.0. If that's true, please upgrade to DJGPP v2.01 and see if that helps. Another possible solution is to force DJGPP startup code to use Unix-style `sbrk' algorithm. To this end, put these lines at the beginning of your source: #include int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK; then rebuild and see if the problem goes away. (The default `sbrk' algorithm sometimes does things which NT doesn't allow.) > 4/ The "mem /c" command reports that 16 bytes have been loosed after > a DJ program runs on our NT console (but NOT on other O.S.), but > it happens on any program, even the "Hello world". I suspect a bug in the NT DPMI server. I'm not sure whether this is relevant to your trouble.