Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-12-02 18:39:57 +0300
committerCorinna Vinschen <corinna@vinschen.de>2014-12-02 18:39:57 +0300
commitdf386ddac898b283aba4aa2f61b513740b1d9393 (patch)
tree5d6fee0c84a16f7211e0a691e2ed89b6d4d46286 /winsup
parent44cacc7f4409904bcff9438de7c5e5f4f4ceca22 (diff)
* flock.cc (create_lock_in_parent): Make lf_obj handle inheritable.
Explain why. (lockf_t::create_lock_obj): Use FALSE, rather than 0 for BOOL argument. (lockf_t::del_lock_obj): Check if NtSetEvent succeeded and print system message if not.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/flock.cc12
-rw-r--r--winsup/cygwin/spawn.cc1
3 files changed, 19 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index e132577a5..c93eeba37 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,13 @@
2014-12-02 Corinna Vinschen <corinna@vinschen.de>
+ * flock.cc (create_lock_in_parent): Make lf_obj handle inheritable.
+ Explain why.
+ (lockf_t::create_lock_obj): Use FALSE, rather than 0 for BOOL argument.
+ (lockf_t::del_lock_obj): Check if NtSetEvent succeeded and print system
+ message if not.
+
+2014-12-02 Corinna Vinschen <corinna@vinschen.de>
+
* uinfo.cc (fetch_windows_home): New function fetching Windows-compliant
home directory. Include longish comment to explain what we're doing.
(cygheap_pwdgrp::get_home): Take additional sid parameter. In
diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc
index 540d914e3..783bf327d 100644
--- a/winsup/cygwin/flock.cc
+++ b/winsup/cygwin/flock.cc
@@ -703,6 +703,12 @@ create_lock_in_parent (PVOID param)
NtClose (lf_obj);
return 0;
}
+ /* The handle gets created non-inheritable. That's fine, unless the parent
+ starts another process accessing this object. So, after it's clear we
+ have to store the handle for further use, make sure it gets inheritable
+ by child processes. */
+ if (!SetHandleInformation (lf_obj, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT))
+ goto err;
/* otherwise generate inode from directory name... */
node = inode_t::get (dev, ino, true, false);
/* ...and generate lock from object name. */
@@ -810,7 +816,7 @@ lockf_t::create_lock_obj ()
return;
}
if (!DuplicateHandle (GetCurrentProcess (), lf_obj, parent_proc,
- &parent_lf_obj, TRUE, 0, DUPLICATE_SAME_ACCESS))
+ &parent_lf_obj, TRUE, FALSE, DUPLICATE_SAME_ACCESS))
debug_printf ("DuplicateHandle (lf_obj): %E");
else
{
@@ -873,7 +879,9 @@ lockf_t::del_lock_obj (HANDLE fhdl, bool signal)
if ((lf_flags & F_POSIX) || signal
|| (fhdl && get_obj_handle_count (fhdl) <= 1))
{
- NtSetEvent (lf_obj, NULL);
+ NTSTATUS status = NtSetEvent (lf_obj, NULL);
+ if (!NT_SUCCESS (status))
+ system_printf ("NtSetEvent, %y", status);
/* For BSD locks, notify the parent process. */
if (lf_flags & F_FLOCK)
{
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index a0686c5d8..9f9c349db 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -467,6 +467,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
}
}
+debug_printf ("ping 1");
if (mode == _P_DETACH)
c_flags |= DETACHED_PROCESS;
else