* flock.cc (allow_others_to_sync): Use small stack buffer rather

than big temp buffer.  Fix typo in comment.
	(lf_setlock): Revert to using tmp_pathbuf.
	(lf_getlock): Ditto.
This commit is contained in:
Corinna Vinschen 2010-06-22 14:53:05 +00:00
parent c7b24005e6
commit 30bbc55ee2
2 changed files with 19 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2010-06-22 Corinna Vinschen <corinna@vinschen.de>
* flock.cc (allow_others_to_sync): Use small stack buffer rather
than big temp buffer. Fix typo in comment.
(lf_setlock): Revert to using tmp_pathbuf.
(lf_getlock): Ditto.
2010-06-22 Corinna Vinschen <corinna@vinschen.de> 2010-06-22 Corinna Vinschen <corinna@vinschen.de>
* sec_acl.cc (setacl): Use the long time unused ACL_DEFAULT_SIZE * sec_acl.cc (setacl): Use the long time unused ACL_DEFAULT_SIZE

View File

@ -105,7 +105,7 @@
#include "pinfo.h" #include "pinfo.h"
#include "sigproc.h" #include "sigproc.h"
#include "cygtls.h" #include "cygtls.h"
#include "tmpbuf.h" #include "tls_pbuf.h"
#include "ntdll.h" #include "ntdll.h"
#include <sys/queue.h> #include <sys/queue.h>
#include <wchar.h> #include <wchar.h>
@ -151,20 +151,20 @@ allow_others_to_sync ()
LPVOID ace; LPVOID ace;
ULONG len; ULONG len;
/* Get this process DACL. We use a temporary buffer to avoid having to /* Get this process DACL. We use a rather small stack buffer here which
alloc 64K from the stack. Can't use tls functions at this point because should be more than sufficient for process ACLs. Can't use tls functions
this gets called during initialization when the tls is not really at this point because this gets called during initialization when the tls
available. */ is not really available. */
tmpbuf sd; PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR) alloca (ACL_DEFAULT_SIZE);
status = NtQuerySecurityObject (NtCurrentProcess (), status = NtQuerySecurityObject (NtCurrentProcess (),
DACL_SECURITY_INFORMATION, sd, DACL_SECURITY_INFORMATION, sd,
NT_MAX_PATH * sizeof (WCHAR), &len); ACL_DEFAULT_SIZE, &len);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
debug_printf ("NtQuerySecurityObject: %p", status); debug_printf ("NtQuerySecurityObject: %p", status);
return; return;
} }
/* Create a valid dacl pointer and set it's size to be as big as /* Create a valid dacl pointer and set its size to be as big as
there's room in the temporary buffer. Note that the descriptor there's room in the temporary buffer. Note that the descriptor
is in self-relative format. */ is in self-relative format. */
dacl = (PACL) ((char *) sd + (uintptr_t) sd->Dacl); dacl = (PACL) ((char *) sd + (uintptr_t) sd->Dacl);
@ -874,7 +874,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
lockf_t **head = lock->lf_head; lockf_t **head = lock->lf_head;
lockf_t **prev, *overlap; lockf_t **prev, *overlap;
int ovcase, priority, old_prio, needtolink; int ovcase, priority, old_prio, needtolink;
tmpbuf tp; tmp_pathbuf tp;
/* /*
* Set the priority * Set the priority
@ -886,7 +886,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
* Scan lock list for this file looking for locks that would block us. * Scan lock list for this file looking for locks that would block us.
*/ */
/* Create temporary space for the all locks list. */ /* Create temporary space for the all locks list. */
node->i_all_lf = (lockf_t *) (void *) tp; node->i_all_lf = (lockf_t *) (void *) tp.w_get ();
while ((block = lf_getblock(lock, node))) while ((block = lf_getblock(lock, node)))
{ {
DWORD ret; DWORD ret;
@ -1228,10 +1228,10 @@ static int
lf_getlock (lockf_t *lock, inode_t *node, struct __flock64 *fl) lf_getlock (lockf_t *lock, inode_t *node, struct __flock64 *fl)
{ {
lockf_t *block; lockf_t *block;
tmpbuf tp; tmp_pathbuf tp;
/* Create temporary space for the all locks list. */ /* Create temporary space for the all locks list. */
node->i_all_lf = (lockf_t *) (void * ) tp; node->i_all_lf = (lockf_t *) (void * ) tp.w_get ();
if ((block = lf_getblock (lock, node))) if ((block = lf_getblock (lock, node)))
{ {
if (block->lf_obj) if (block->lf_obj)