diff --git a/winsup/cygwin/glob.c b/winsup/cygwin/glob.c index 971b3092e..32e4e60d6 100644 --- a/winsup/cygwin/glob.c +++ b/winsup/cygwin/glob.c @@ -833,7 +833,7 @@ g_lstat(fn, sb, pglob) { /* FIXME: This only works as long as the application uses the old struct stat with 32 bit off_t types!!! - + As soon as we switch over to 64 bit, we have to decide by the applications API minor version number, whether to use a pointer to a __stat64 or a _stat32 struct to the @@ -867,7 +867,7 @@ g_stat(fn, sb, pglob) { /* FIXME: This only works as long as the application uses the old struct stat with 32 bit off_t types!!! - + As soon as we switch over to 64 bit, we have to decide by the applications API minor version number, whether to use a pointer to a __stat64 or a _stat32 struct to the diff --git a/winsup/cygwin/how-autoload-works.txt b/winsup/cygwin/how-autoload-works.txt index 27c2426d8..4f96d8beb 100644 --- a/winsup/cygwin/how-autoload-works.txt +++ b/winsup/cygwin/how-autoload-works.txt @@ -55,12 +55,12 @@ function that was not used there before, you should add a stub so it will be autoloaded. To do so, add one of the LoadDllfunc* macros to autoload.cc. All macros eventually resolve to the following form: -LoadDLLfuncEx2 (function name, parameter block length, dll name, +LoadDLLfuncEx2 (function name, parameter block length, dll name, non-fatality flag , value to return if function not available) -Parameter block length is a sum of sizes (in bytes) of parameters which are -being passed to the function. If non-fatality flag is set to 0, then failure -to load dll and find a function will cause fatal error. If non fatality flag +Parameter block length is a sum of sizes (in bytes) of parameters which are +being passed to the function. If non-fatality flag is set to 0, then failure +to load dll and find a function will cause fatal error. If non fatality flag is set to 1, then call to the function will return default value. You can also use shorter versions -- LoadDLLfuncEx and LoadDLLfunc, if the defaults they provide suit your needs. diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cygwin/stat.h index 5772a3754..1c1a5cd1f 100644 --- a/winsup/cygwin/include/cygwin/stat.h +++ b/winsup/cygwin/include/cygwin/stat.h @@ -60,7 +60,7 @@ extern int lstat64 (const char *file_name, struct __stat64 *buf); #endif struct stat -{ +{ dev_t st_dev; ino_t st_ino; mode_t st_mode; diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h index 96aa4deea..02b8b89d4 100644 --- a/winsup/cygwin/include/pthread.h +++ b/winsup/cygwin/include/pthread.h @@ -103,7 +103,7 @@ void pthread_cleanup_push (void (*routine)(void*), void *arg); void pthread_cleanup_pop (int execute); */ typedef void (*__cleanup_routine_type) (void *); -typedef struct _pthread_cleanup_handler +typedef struct _pthread_cleanup_handler { __cleanup_routine_type function; void *arg; diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 06b9a5acb..b775fb9a7 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -521,6 +521,8 @@ fdsock (int &fd, const char *name, SOCKET soc) winsock2_active); fhandler_socket *fh = (fhandler_socket *) cygheap->fdtab.build_fhandler (fd, FH_SOCKET, name); + if (!fh) + return NULL; fh->set_io_handle ((HANDLE) soc); fh->set_flags (O_RDWR | O_BINARY); fh->set_r_no_interrupt (winsock2_active); @@ -558,12 +560,17 @@ cygwin_socket (int af, int type, int protocol) name = (type == SOCK_STREAM ? "/dev/streamsocket" : "/dev/dgsocket"); fh = fdsock (fd, name, soc); - if (fh) + if (!fh) + { + closesocket (soc); + res = -1; + } + else { fh->set_addr_family (af); fh->set_socket_type (type); + res = fd; } - res = fd; } done: diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h index 829a2c1ba..89b683f94 100644 --- a/winsup/cygwin/pinfo.h +++ b/winsup/cygwin/pinfo.h @@ -92,7 +92,7 @@ public: /* Non-zero if process was stopped by a signal. */ char stopsig; - + /* commune */ pid_t hello_pid; HANDLE tothem; diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc index a928002c5..3766128fb 100644 --- a/winsup/cygwin/sec_acl.cc +++ b/winsup/cygwin/sec_acl.cc @@ -313,7 +313,7 @@ getacl (const char *file, DWORD attr, int nentries, __aclent16_t *aclbufp) for (i = 0; i < acl->AceCount; ++i) { ACCESS_ALLOWED_ACE *ace; - + if (!GetAce (acl, i, (PVOID *) &ace)) continue; @@ -367,7 +367,7 @@ getacl (const char *file, DWORD attr, int nentries, __aclent16_t *aclbufp) } } /* Include DEF_CLASS_OBJ if any default ace exists */ - if ((types_def & (USER|GROUP)) + if ((types_def & (USER|GROUP)) && ((pos = searchace (lacl, MAX_ACL_ENTRIES, DEF_CLASS_OBJ)) >= 0)) { lacl[pos].a_type = DEF_CLASS_OBJ; @@ -378,7 +378,7 @@ getacl (const char *file, DWORD attr, int nentries, __aclent16_t *aclbufp) if ((pos = searchace (lacl, MAX_ACL_ENTRIES, 0)) < 0) pos = MAX_ACL_ENTRIES; if (aclbufp) { - if (EqualSid (owner_sid, group_sid)) + if (EqualSid (owner_sid, group_sid)) lacl[0].a_perm = lacl[1].a_perm; if (pos > nentries) { diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index 32175a4ac..d33750c6b 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -527,7 +527,6 @@ public: } }; - #define MT_INTERFACE user_data->threadinterface extern "C"