* cygheap.h (cygheap_fdenum): Remove start_fd stuff.

(cygheap_fdenum::rewind): Ditto.
* pipe.cc (fhandler_pipe::open): Lock fdtab while enumerating.
* times.cc (utimes_worker): Ditto.
This commit is contained in:
Christopher Faylor 2005-10-24 15:09:07 +00:00
parent 95baaf8819
commit 16bbf0cc57
4 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2005-10-24 Christopher Faylor <cgf@timesys.com>
* cygheap.h (cygheap_fdenum): Remove start_fd stuff.
(cygheap_fdenum::rewind): Ditto.
* pipe.cc (fhandler_pipe::open): Lock fdtab while enumerating.
* times.cc (utimes_worker): Ditto.
2005-10-23 Christopher Faylor <cgf@timesys.com> 2005-10-23 Christopher Faylor <cgf@timesys.com>
* cygheap.h (cygheap_fdenum::cygheap_fdenum): Record locked state or * cygheap.h (cygheap_fdenum::cygheap_fdenum): Record locked state or

View File

@ -394,14 +394,13 @@ class cygheap_fdget : public cygheap_fdmanip
class cygheap_fdenum : public cygheap_fdmanip class cygheap_fdenum : public cygheap_fdmanip
{ {
int start_fd;
public: public:
cygheap_fdenum (int start_fd = -1, bool lockit = false) cygheap_fdenum (bool lockit = false)
{ {
locked = lockit; locked = lockit;
if (lockit) if (lockit)
cygheap->fdtab.lock (); cygheap->fdtab.lock ();
this->start_fd = fd = start_fd < 0 ? -1 : start_fd; fd = -1;
} }
int next () int next ()
{ {
@ -412,7 +411,7 @@ class cygheap_fdenum : public cygheap_fdmanip
} }
void rewind () void rewind ()
{ {
fd = start_fd; fd = -1;
} }
}; };

View File

@ -49,7 +49,7 @@ fhandler_pipe::open (int flags, mode_t mode)
sscanf (get_name (), "/proc/%d/fd/pipe:[%d]", &pid, (int *) &pipe_hdl); sscanf (get_name (), "/proc/%d/fd/pipe:[%d]", &pid, (int *) &pipe_hdl);
if (pid == myself->pid) if (pid == myself->pid)
{ {
cygheap_fdenum cfd; cygheap_fdenum cfd (true);
while (cfd.next () >= 0) while (cfd.next () >= 0)
{ {
if (cfd->get_handle () != pipe_hdl) if (cfd->get_handle () != pipe_hdl)

View File

@ -454,7 +454,7 @@ utimes_worker (const char *path, const struct timeval *tvp, int nofollow)
fhandler_base *fh = NULL; fhandler_base *fh = NULL;
bool fromfd = false; bool fromfd = false;
cygheap_fdenum cfd; cygheap_fdenum cfd (true);
while (cfd.next () >= 0) while (cfd.next () >= 0)
if (cfd->get_access () & (FILE_WRITE_ATTRIBUTES | GENERIC_WRITE) if (cfd->get_access () & (FILE_WRITE_ATTRIBUTES | GENERIC_WRITE)
&& strcmp (cfd->get_win32_name (), win32) == 0) && strcmp (cfd->get_win32_name (), win32) == 0)