* 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

@ -122,6 +122,15 @@ const char * __stdcall find_exec (const char *name, path_conv& buf, const char *
#define isdrive(s) (isalpha (*(s)) && (s)[1] == ':')
static inline bool
has_exec_chars (const char *buf, int len)
{
return len >= 2 &&
((buf[0] == '#' && buf[1] == '!') ||
(buf[0] == ':' && buf[1] == '\n') ||
(buf[0] == 'M' && buf[1] == 'Z'));
}
/* cwd cache stuff. */
class muto;