summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-03-02 17:20:11 +0000
committerCorinna Vinschen <corinna@vinschen.de>2012-03-02 17:20:11 +0000
commit56bed670461db0bd7ccbb4315b7b6b0c4e418dab (patch)
tree73c4019213d55cf9eed6e6ce55378fd6a270d7f8
parentb4ad7197fb1ad7dccdab927b93b52a5128cd293f (diff)
downloadcygnal-56bed670461db0bd7ccbb4315b7b6b0c4e418dab.tar.gz
cygnal-56bed670461db0bd7ccbb4315b7b6b0c4e418dab.tar.bz2
cygnal-56bed670461db0bd7ccbb4315b7b6b0c4e418dab.zip
* flock.cc (allow_others_to_sync): Reorder conditional expression to
check for DACL presence first, since otherwise dacl pointer value is undefined. Add comment.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/flock.cc12
2 files changed, 12 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index c6273aa33..53a003a95 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2012-03-02 Corinna Vinschen <corinna@vinschen.de>
+ * flock.cc (allow_others_to_sync): Reorder conditional expression to
+ check for DACL presence first, since otherwise dacl pointer value is
+ undefined. Add comment.
+
+2012-03-02 Corinna Vinschen <corinna@vinschen.de>
+
* flock.cc (allow_others_to_sync): Use RtlGetDaclSecurityDescriptor
rather than accessing the SECURITY_DESCRIPTOR structure directly.
Take no DACL and NULL DACL into account.
diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc
index c66891a35..176e4869e 100644
--- a/winsup/cygwin/flock.cc
+++ b/winsup/cygwin/flock.cc
@@ -178,16 +178,16 @@ allow_others_to_sync ()
is in self-relative format. */
BOOLEAN present, defaulted;
RtlGetDaclSecurityDescriptor (sd, &present, &dacl, &defaulted);
- if (dacl == NULL) /* Everyone has all access anyway */
- {
- done = true;
- return;
- }
- else if (!present)
+ if (!present) /* If so, dacl has undefined value. */
{
dacl = (PACL) (sd + 1);
RtlCreateAcl (dacl, MAX_PROCESS_SD_SIZE - sizeof *sd, ACL_REVISION);
}
+ else if (dacl == NULL) /* Everyone has all access anyway */
+ {
+ done = true;
+ return;
+ }
else
{
dacl->AclSize = MAX_PROCESS_SD_SIZE - ((PBYTE) dacl - (PBYTE) sd);