Date: Thu, 12 Jun 1997 18:10:40 +0300 (IDT) From: Eli Zaretskii To: Nate Eldredge cc: djgpp AT delorie DOT com Subject: Re: DJGPP runs bogus binaries In-Reply-To: <199706110126.SAA21249@adit.ap.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Tue, 10 Jun 1997, Nate Eldredge wrote: > direct_exec_tail in dosexec.c is the entry point for things that DOS is > going to exec (function 0x4B). A check could be added here that the program > name ends in ".com" or ".exe". A good place to put this might be around line > 190, after the TRUENAME call. Any file not ending in these is probably not a > valid DOS executable. No, that's wrong IMHO. There's no reason to prevent a user to do whatever they want. DOS doesn't require the executables to have a certain extension, why should DJGPP? It is perfectly legal to rename a .com program to any other extension and still expect it to run. The problem is of course exactly that there's no method (known to me) to detect .com images without relying on the extension. If the application programmer *knows* that the file they want to invoke must be one of the executables DJGPP knows about, the application could always call the `_is_executable' library function (or more portable `stat') on the file before they call `spawn'.