From e52961c4030158894204a75c004da23a3d42ac0d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 12 Dec 2010 15:32:45 +0000 Subject: [PATCH] * syscalls.cc (check_dir_not_empty): Never count more than 3 directory entries. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/syscalls.cc | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 1de5dee9f..06ce36314 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2010-12-12 Corinna Vinschen + + * syscalls.cc (check_dir_not_empty): Never count more than 3 directory + entries. + 2010-12-12 Christopher Faylor * init.cc (search_for): Put this in shared section or suffer subtle diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index eeb998aaf..c38671f39 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -514,14 +514,13 @@ check_dir_not_empty (HANDLE dir) int cnt = 1; while (pfni->NextEntryOffset) { + if (++cnt > 2) + { + syscall_printf ("Directory not empty"); + return STATUS_DIRECTORY_NOT_EMPTY; + } pfni = (PFILE_NAMES_INFORMATION) ((caddr_t) pfni + pfni->NextEntryOffset); - ++cnt; - } - if (cnt > 2) - { - syscall_printf ("Directory not empty"); - return STATUS_DIRECTORY_NOT_EMPTY; } return STATUS_SUCCESS; }