From: jeffdbREMOVETHIS AT goodnet DOT com (Mikey) Subject: Re: What does it mean? 28 Jun 1998 11:51:29 -0700 Message-ID: <359689d1.63909010.cygnus.cygwin32.developers@smtp.goodnet.com> References: <01BDA29D DOT 2DCD33F0 AT sos> Reply-To: jeffdbREMOVETHIS AT goodnet DOT com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Sergey Okhapkin Cc: cygwin32-developers AT cygnus DOT com This code is unneeded on NT AFAIK, it was added because win95 w/B19.1- couldn't find shell scripts in path. On Sun, 28 Jun 1998 14:00:58 +0400, you wrote: >Hi! > >fhandler_disk_file::open() contains the following code: > > if ((os_being_run != winNT) && (!real_path.exec_p)) > { > DWORD done; > char magic[2]; > /* FIXME should we use /etc/magic ? */ > magic[0] = magic[1] = magic[2] = '\0'; > ReadFile (get_handle (), magic, 3, &done, 0); > if (magic[0] == ':' && magic[1] == '\n') > real_path.exec_p = 1; > > if (magic[0] == '#' && magic[1] == '!') > real_path.exec_p = 1; > if (flags & O_APPEND) > SetFilePointer (get_handle(), 0, 0, FILE_END); > else > SetFilePointer (get_handle(), 0, 0, FILE_BEGIN); > } > >The code seems to me buggy! Why we do not check file magic and do not set file pointer on NT? Shouldn't the code be something like: > > if (!real_path.exec_p) > { > DWORD done; > char magic[2]; > /* FIXME should we use /etc/magic ? */ > magic[0] = magic[1] = magic[2] = '\0'; > ReadFile (get_handle (), magic, 3, &done, 0); > if (magic[0] == ':' && magic[1] == '\n') > real_path.exec_p = 1; > > if (magic[0] == '#' && magic[1] == '!') > real_path.exec_p = 1; > } > if (flags & O_APPEND) > SetFilePointer (get_handle(), 0, 0, FILE_END); > else > SetFilePointer (get_handle(), 0, 0, FILE_BEGIN); ===================================================== Linux a platform built by, and for users, standing on the firm legs of reliability, and speed. Microsoft Windows, a platform without a leg to stand on. (jeffdbREMOVETHIS AT goodnet DOT com) delete REMOVETHIS from the above to reply Mikey