diff options
author | Christopher Faylor <me@cgf.cx> | 2001-10-24 08:16:45 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-10-24 08:16:45 +0400 |
commit | a0626ebe27cd82210cf73434e518b258b59dcdb7 (patch) | |
tree | 62642f1b1f35ca1ffa2d401ec7b1290a512ef329 /winsup/cygwin/miscfuncs.cc | |
parent | 0280c8c0f342663f3a9c3844db5462125bac4a6c (diff) |
Ensure that all fhandler_*::read definitions are __stdcall throughout.
* fhandler.cc (fhandler_base::set_inheritance): Be more defensive in debugging
code.
* fhandler.h: Adjust regparms throughout to reflect passing 'this' parameter.
* fhandler_console.cc (fhandler_console::read): Remove unneeded test. Only
honor "key down" events.
* miscfuncs.cc (strcasestr): Reorganize for efficient code use.
(check_null_empty_str_errno): Ditto.
(__check_null_invalid_struct_errno): Ditto.
(__check_invalid_read_ptr_errno): Ditto.
* syscalls.cc (_read): Return 0 when length == 0, as per Single UNIX
Specification.
Diffstat (limited to 'winsup/cygwin/miscfuncs.cc')
-rw-r--r-- | winsup/cygwin/miscfuncs.cc | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index ecc5bd203..4d72339cb 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -118,13 +118,10 @@ strcasestr (const char *searchee, const char *lookfor) int __stdcall check_null_empty_str (const char *name) { - if (!name || IsBadStringPtr (name, MAX_PATH)) - return EFAULT; + if (name && !IsBadStringPtr (name, MAX_PATH)) + return !*name ? ENOENT : 0; - if (!*name) - return ENOENT; - - return 0; + return EFAULT; } int __stdcall @@ -139,26 +136,25 @@ check_null_empty_str_errno (const char *name) int __stdcall __check_null_invalid_struct (const void *s, unsigned sz) { - if (!s || IsBadWritePtr ((void *) s, sz)) - return EFAULT; + if (s && !IsBadWritePtr ((void *) s, sz)) + return 0; - return 0; + return EFAULT; } int __stdcall __check_null_invalid_struct_errno (const void *s, unsigned sz) { - int __err; - if ((__err = __check_null_invalid_struct (s, sz))) - set_errno (__err); - return __err; + int err; + if ((err = __check_null_invalid_struct (s, sz))) + set_errno (err); + return err; } int __stdcall __check_invalid_read_ptr_errno (const void *s, unsigned sz) { - if (!s || IsBadReadPtr ((void *) s, sz)) - return set_errno (EFAULT); - - return 0; + if (s && !IsBadReadPtr ((void *) s, sz)) + return 0; + return set_errno (EFAULT); } |