* path.h (has_exec_chars): Standard function for checking for executable magic

numbers.
* path.cc (symlink_info::check): Use the above function.
* fhandler.cc (fhandler_disk_file::open): Ditto.
This commit is contained in:
Christopher Faylor
2000-10-31 23:14:29 +00:00
parent 772e2322bd
commit b12796a06d
4 changed files with 22 additions and 6 deletions

View File

@ -2319,11 +2319,12 @@ symlink_info::check (const char *in_path, const suffix_info *suffixes)
else
{
/* Not a symlink, see if executable. */
if (!(pflags & PATH_ALL_EXEC) && got >= 2 &&
((cookie_buf[0] == '#' && cookie_buf[1] == '!') ||
(cookie_buf[0] == ':' && cookie_buf[1] == '\n') ||
(cookie_buf[0] == 'M' && cookie_buf[1] == 'Z')))
if (!(pflags & PATH_ALL_EXEC) &&
has_exec_chars (cookie_buf, got))
{
debug_printf ("setting exec flag");
pflags |= PATH_EXEC;
}
close_and_return:
CloseHandle (h);
goto file_not_symlink;