diff options
author | Christopher Faylor <me@cgf.cx> | 2000-10-31 23:14:29 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-10-31 23:14:29 +0000 |
commit | b12796a06d220e56474d2b28158fda9a193d9f37 (patch) | |
tree | 1333fe686fd71dd00c822095dc09969cd59a6c4f /winsup/cygwin/path.h | |
parent | 772e2322bd066c72b8af0f82f82c51306088bacc (diff) | |
download | newlib-b12796a06d220e56474d2b28158fda9a193d9f37.zip newlib-b12796a06d220e56474d2b28158fda9a193d9f37.tar.gz newlib-b12796a06d220e56474d2b28158fda9a193d9f37.tar.bz2 |
* 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.
Diffstat (limited to 'winsup/cygwin/path.h')
-rw-r--r-- | winsup/cygwin/path.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 14367c7..70ec2d2 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -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; |