* 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

@ -1227,8 +1227,7 @@ fhandler_disk_file::open (path_conv& real_path, int flags, mode_t mode)
/* 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') ||
(magic[0] == '#' && magic[1] == '!'))
if (has_exec_chars (magic, done))
real_path.set_exec ();
if (!(flags & O_APPEND))
SetFilePointer (get_handle(), 0, 0, FILE_BEGIN);