aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/fhandler/base.cc4
-rw-r--r--winsup/cygwin/release/3.6.43
-rw-r--r--winsup/cygwin/spawn.cc17
3 files changed, 16 insertions, 8 deletions
diff --git a/winsup/cygwin/fhandler/base.cc b/winsup/cygwin/fhandler/base.cc
index 6c95e2b..64a5f6a 100644
--- a/winsup/cygwin/fhandler/base.cc
+++ b/winsup/cygwin/fhandler/base.cc
@@ -720,9 +720,9 @@ fhandler_base::open (int flags, mode_t mode)
goto done;
}
- if (get_device () == FH_FS)
+ if (get_device () == FH_FS && (flags & O_CREAT))
{
- /* Fix up file attributes, they are desperately needed later.
+ /* Fix up file attributes if we just made an attempt to create the file.
Originally we only did that in the FILE_CREATED case below, but that's
insufficient:
diff --git a/winsup/cygwin/release/3.6.4 b/winsup/cygwin/release/3.6.4
index 3286991..4338214 100644
--- a/winsup/cygwin/release/3.6.4
+++ b/winsup/cygwin/release/3.6.4
@@ -25,3 +25,6 @@ Fixes:
- Fix potential crashing a process PID by accessing /proc/PID/maps
in parallel.
Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258198.html
+
+- Fix ACL operations on directories.
+ Addresses: https://cygwin.com/pipermail/cygwin/2025-July/258433.html
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index ef175e7..cb58b6e 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -544,9 +544,6 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
c_flags |= CREATE_NEW_PROCESS_GROUP;
refresh_cygheap ();
- if (c_flags & CREATE_NEW_PROCESS_GROUP)
- InterlockedOr ((LONG *) &myself->process_state, PID_NEW_PG);
-
if (mode == _P_DETACH)
/* all set */;
else if (mode != _P_OVERLAY || !my_wr_proc_pipe)
@@ -605,7 +602,12 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
::cygheap->user.deimpersonate ();
if (!real_path.iscygexec () && mode == _P_OVERLAY)
- InterlockedOr ((LONG *) &myself->process_state, PID_NOTCYGWIN);
+ {
+ LONG pidflags = PID_NOTCYGWIN;
+ if (c_flags & CREATE_NEW_PROCESS_GROUP)
+ pidflags |= PID_NEW_PG;
+ InterlockedOr ((LONG *) &myself->process_state, pidflags);
+ }
cygpid = (mode != _P_OVERLAY) ? create_cygwin_pid () : myself->pid;
@@ -707,7 +709,8 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
myself->sendsig = myself->exec_sendsig;
myself->exec_sendsig = NULL;
}
- InterlockedAnd ((LONG *) &myself->process_state, ~PID_NOTCYGWIN);
+ InterlockedAnd ((LONG *) &myself->process_state,
+ ~(PID_NOTCYGWIN|PID_NEW_PG));
/* Reset handle inheritance to default when the execution of a'
non-Cygwin process fails. Only need to do this for _P_OVERLAY
since the handle will be closed otherwise. Don't need to do
@@ -769,7 +772,9 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
myself->set_has_pgid_children ();
ProtectHandle (pi.hThread);
pinfo child (cygpid,
- PID_IN_USE | (real_path.iscygexec () ? 0 : PID_NOTCYGWIN));
+ PID_IN_USE |
+ (real_path.iscygexec () ? 0 : PID_NOTCYGWIN) |
+ ((c_flags & CREATE_NEW_PROCESS_GROUP) ? PID_NEW_PG : 0));
if (!child)
{
syscall_printf ("pinfo failed");