Common subdirectories: /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/config and /src/cygwin-snapshot-20080822-1/winsup/cygwin/config diff -u /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/dtable.cc /src/cygwin-snapshot-20080822-1/winsup/cygwin/dtable.cc --- /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/dtable.cc 2008-05-21 18:34:09.000000000 -0700 +++ /src/cygwin-snapshot-20080822-1/winsup/cygwin/dtable.cc 2008-08-26 09:51:19.296875000 -0700 @@ -851,6 +851,14 @@ WCHAR *maxmatchdos = NULL; int maxmatchlen = 0; +// This is to here avoid goto crossing initialization. + if (0) + { +unknown: + strcpy (posix_fn, unknown_file); + return false; + } + NtQueryObject (h, ObjectNameInformation, &dummy_oni, sizeof (dummy_oni), &len); if (!len) { @@ -969,8 +977,4 @@ debug_printf ("derived path '%W', posix '%s'", w32, posix_fn); return false; - -unknown: - strcpy (posix_fn, unknown_file); - return false; } diff -u /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/fhandler_fifo.cc /src/cygwin-snapshot-20080822-1/winsup/cygwin/fhandler_fifo.cc --- /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/fhandler_fifo.cc 2008-08-21 21:06:49.000000000 -0700 +++ /src/cygwin-snapshot-20080822-1/winsup/cygwin/fhandler_fifo.cc 2008-08-26 09:41:36.328125000 -0700 @@ -131,11 +131,13 @@ switch (wait_state) { case fifo_wait_for_client: - bool res = ConnectNamedPipe (get_handle (), get_overlapped ()); - DWORD dummy_bytes; - if (res || GetLastError () == ERROR_PIPE_CONNECTED) - return true; - return wait_overlapped (res, iswrite, &dummy_bytes); + { + bool res = ConnectNamedPipe (get_handle (), get_overlapped ()); + DWORD dummy_bytes; + if (res || GetLastError () == ERROR_PIPE_CONNECTED) + return true; + return wait_overlapped (res, iswrite, &dummy_bytes); + } default: break; } diff -u /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/hookapi.cc /src/cygwin-snapshot-20080822-1/winsup/cygwin/hookapi.cc --- /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/hookapi.cc 2008-05-10 10:08:41.000000000 -0700 +++ /src/cygwin-snapshot-20080822-1/winsup/cygwin/hookapi.cc 2008-08-26 09:54:30.218750000 -0700 @@ -160,7 +160,8 @@ /* Find first missing dll in a given executable. FIXME: This is not foolproof since it doesn't look for dlls in the same directory as the given executable, like Windows. Instead it - searches for dlls in the context of the current executable. */ + searches for dlls in the context of the current executable. + This is not thread safe, but only used by strace. */ const char * find_first_notloaded_dll (path_conv& pc) { @@ -172,6 +173,15 @@ HANDLE h; NTSTATUS status; +// This is here to avoid goto crossing initialization. + if (0) + { +out: + if (hm) + UnmapViewOfFile (hm); + return res; + } + status = NtOpenFile (&h, SYNCHRONIZE | GENERIC_READ, pc.get_object_attr (attr, sec_none_nih), &io, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -194,6 +204,9 @@ if (!pExeNTHdr) goto out; + if (IMAGE_DIRECTORY_ENTRY_IMPORT >= pExeNTHdr->OptionalHeader.NumberOfRvaAndSizes) + goto out; + DWORD importRVA; importRVA = pExeNTHdr->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress; if (!importRVA) @@ -209,19 +222,14 @@ for (PIMAGE_IMPORT_DESCRIPTOR pd = pdfirst; pd->FirstThunk; pd++) { const char *lib = rva (PSTR, hm, pd->Name - delta); - if (!LoadLibraryEx (lib, NULL, DONT_RESOLVE_DLL_REFERENCES - | LOAD_LIBRARY_AS_DATAFILE)) + if (!LoadLibraryEx (lib, NULL, LOAD_LIBRARY_AS_DATAFILE)) { static char buf[NT_MAX_PATH]; res = strcpy (buf, lib); } } -out: - if (hm) - UnmapViewOfFile (hm); - - return res; + goto out; } // Top level routine to find the EXE's imports and redirect them Common subdirectories: /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/include and /src/cygwin-snapshot-20080822-1/winsup/cygwin/include Common subdirectories: /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/lib and /src/cygwin-snapshot-20080822-1/winsup/cygwin/lib Common subdirectories: /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/libc and /src/cygwin-snapshot-20080822-1/winsup/cygwin/libc diff -u /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/path.cc /src/cygwin-snapshot-20080822-1/winsup/cygwin/path.cc --- /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/path.cc 2008-08-21 21:06:49.000000000 -0700 +++ /src/cygwin-snapshot-20080822-1/winsup/cygwin/path.cc 2008-08-26 09:46:01.312500000 -0700 @@ -2775,22 +2775,24 @@ switch (what) { case CCP_POSIX_TO_WIN_A: - p.check ((const char *) from, - PC_POSIX | PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK | PC_NOWARN - | (relative ? PC_NOFULL : 0)); - if (p.error) - return_with_errno (p.error); - PUNICODE_STRING up = p.get_nt_native_path (); - buf = tp.c_get (); - sys_wcstombs (buf, NT_MAX_PATH, up->Buffer, up->Length / sizeof (WCHAR)); - /* Convert native path to standard DOS path. */ - if (!strncmp (buf, "\\??\\", 4)) - { - buf += 4; - if (buf[1] != ':') /* native UNC path */ - *(buf += 2) = '\\'; - } - lsiz = strlen (buf) + 1; + { + p.check ((const char *) from, + PC_POSIX | PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK | PC_NOWARN + | (relative ? PC_NOFULL : 0)); + if (p.error) + return_with_errno (p.error); + PUNICODE_STRING up = p.get_nt_native_path (); + buf = tp.c_get (); + sys_wcstombs (buf, NT_MAX_PATH, up->Buffer, up->Length / sizeof (WCHAR)); + /* Convert native path to standard DOS path. */ + if (!strncmp (buf, "\\??\\", 4)) + { + buf += 4; + if (buf[1] != ':') /* native UNC path */ + *(buf += 2) = '\\'; + } + lsiz = strlen (buf) + 1; + } break; case CCP_POSIX_TO_WIN_W: p.check ((const char *) from, diff -u /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/pipe.cc /src/cygwin-snapshot-20080822-1/winsup/cygwin/pipe.cc --- /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/pipe.cc 2008-08-21 21:06:49.000000000 -0700 +++ /src/cygwin-snapshot-20080822-1/winsup/cygwin/pipe.cc 2008-08-26 09:50:05.921875000 -0700 @@ -112,8 +112,20 @@ } pipesync::pipesync (HANDLE f, DWORD is_reader): - reader (false), ret_handle (NULL) + reader (false), ret_handle (NULL), ev(NULL) { +// This is here to avoid goto crossing initialization. + if (0) + { +out: + if (ev) + { + CloseHandle (ev); + ev = NULL; + } + return; + } + ev = CreateEvent (&sec_none_nih, true, false, NULL); if (!ev) { @@ -141,13 +153,7 @@ break; } -out: - if (ev) - { - CloseHandle (ev); - ev = NULL; - } - return; + goto out; } void Common subdirectories: /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/regex and /src/cygwin-snapshot-20080822-1/winsup/cygwin/regex diff -u /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/sec_auth.cc /src/cygwin-snapshot-20080822-1/winsup/cygwin/sec_auth.cc --- /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/sec_auth.cc 2008-08-01 12:13:23.000000000 -0700 +++ /src/cygwin-snapshot-20080822-1/winsup/cygwin/sec_auth.cc 2008-08-26 10:03:36.390625000 -0700 @@ -1103,10 +1103,12 @@ authinf->checksum = CYGWIN_VERSION_MAGIC (CYGWIN_VERSION_DLL_MAJOR, CYGWIN_VERSION_DLL_MINOR); - PDWORD csp = (PDWORD) &authinf->username; - PDWORD csp_end = (PDWORD) ((PBYTE) authinf + authinf_size); - while (csp < csp_end) - authinf->checksum += *csp++; + { + PDWORD csp = (PDWORD) &authinf->username; + PDWORD csp_end = (PDWORD) ((PBYTE) authinf + authinf_size); + while (csp < csp_end) + authinf->checksum += *csp++; + } /* Try to logon... */ ret = LsaLogonUser (lsa_hdl, (PLSA_STRING) &origin, Interactive, package_id, diff -u /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/shared_info.h /src/cygwin-snapshot-20080822-1/winsup/cygwin/shared_info.h --- /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/shared_info.h 2008-07-27 15:33:26.000000000 -0700 +++ /src/cygwin-snapshot-20080822-1/winsup/cygwin/shared_info.h 2008-08-26 02:53:31.312500000 -0700 @@ -95,7 +95,7 @@ private: void sort (); void mount_slash (); - void mount_info::create_root_entry (const PWCHAR root); + void create_root_entry (const PWCHAR root); bool from_fstab_line (char *line, bool user); bool from_fstab (bool user, WCHAR [], PWCHAR); diff -u /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/syscalls.cc /src/cygwin-snapshot-20080822-1/winsup/cygwin/syscalls.cc --- /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/syscalls.cc 2008-08-17 09:46:23.000000000 -0700 +++ /src/cygwin-snapshot-20080822-1/winsup/cygwin/syscalls.cc 2008-08-26 10:05:50.203125000 -0700 @@ -3476,6 +3476,16 @@ if (pipe (fds) < 0) return NULL; + if (0) + { +err: + int save_errno = get_errno (); + close (fds[0]); + close (fds[1]); + set_errno (save_errno); + return NULL; + } + switch (rw) { case 'r': @@ -3525,13 +3535,6 @@ fh->set_popen_pid (pid); return fp; - -err: - int save_errno = get_errno (); - close (fds[0]); - close (fds[1]); - set_errno (save_errno); - return NULL; } int diff -u /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/uinfo.cc /src/cygwin-snapshot-20080822-1/winsup/cygwin/uinfo.cc --- /src/cygwin-snapshot-20080822-1.orig/winsup/cygwin/uinfo.cc 2008-07-26 10:01:24.000000000 -0700 +++ /src/cygwin-snapshot-20080822-1/winsup/cygwin/uinfo.cc 2008-08-26 10:08:37.890625000 -0700 @@ -577,9 +577,11 @@ goto out; } buf[fsi.EndOfFile.LowPart] = '\0'; - char *eptr = buf; - while ((eptr = add_line (eptr))) - continue; + { + char *eptr = buf; + while ((eptr = add_line (eptr))) + continue; + } debug_printf ("%W curr_lines %d", rel_path, curr_lines); res = succeeded;