* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Oops. Only do the

executable thing for #! scripts since .exe files wouldn't be executable in
ntsec case regardless.
This commit is contained in:
Christopher Faylor 2002-10-22 21:35:21 +00:00
parent 7dcbb978e0
commit 046a4e718e
2 changed files with 33 additions and 27 deletions

View File

@ -1,3 +1,9 @@
2002-10-22 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Oops. Only
do the executable thing for #! scripts since .exe files wouldn't be
executable in ntsec case regardless.
2002-10-22 Christopher Faylor <cgf@redhat.com> 2002-10-22 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always

View File

@ -301,36 +301,36 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc,
{ {
buf->st_mode |= S_IFREG; buf->st_mode |= S_IFREG;
} }
if (pc->exec_state () == is_executable)
buf->st_mode |= STD_XBITS;
} }
if (buf->st_mode & STD_XBITS) if (buf->st_mode & STD_XBITS)
/* already derived */; /* already derived */;
else if (pc->exec_state () == is_executable) else if (pc->exec_state () == dont_know_if_executable)
buf->st_mode |= STD_XBITS; {
else if (pc->exec_state () == dont_know_if_executable) DWORD cur, done;
{ char magic[3];
DWORD cur, done;
char magic[3];
/* First retrieve current position, set to beginning /* First retrieve current position, set to beginning
of file if not already there. */ of file if not already there. */
cur = SetFilePointer (get_handle (), 0, NULL, FILE_CURRENT); cur = SetFilePointer (get_handle (), 0, NULL, FILE_CURRENT);
if (cur != INVALID_SET_FILE_POINTER if (cur != INVALID_SET_FILE_POINTER
&& (!cur || SetFilePointer (get_handle (), 0, NULL, FILE_BEGIN) && (!cur || SetFilePointer (get_handle (), 0, NULL, FILE_BEGIN)
!= INVALID_SET_FILE_POINTER)) != INVALID_SET_FILE_POINTER))
{ {
/* FIXME should we use /etc/magic ? */ /* FIXME should we use /etc/magic ? */
magic[0] = magic[1] = magic[2] = '\0'; magic[0] = magic[1] = magic[2] = '\0';
if (ReadFile (get_handle (), magic, 3, &done, NULL) && if (ReadFile (get_handle (), magic, 3, &done, NULL) &&
has_exec_chars (magic, done)) has_exec_chars (magic, done))
{ {
set_execable_p (); set_execable_p ();
pc->set_exec (); pc->set_exec ();
buf->st_mode |= STD_XBITS; buf->st_mode |= STD_XBITS;
} }
SetFilePointer (get_handle (), cur, NULL, FILE_BEGIN); SetFilePointer (get_handle (), cur, NULL, FILE_BEGIN);
} }
} }
buf->st_uid = uid; buf->st_uid = uid;
buf->st_gid = gid; buf->st_gid = gid;