Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2009-08-04 08:20:36 +0400
committerChristopher Faylor <me@cgf.cx>2009-08-04 08:20:36 +0400
commit824d851859450e8c3943d0439fc57a3520081eb4 (patch)
treef6ac160a57aee5c0875ba90309fba2ce6337158c /winsup/cygwin
parentff7b364c121175ad1b5b88ec4010ee81dab1e5c4 (diff)
* fhandler.h (fhandler_cygdrive:DRVSZ): New enum.
(pdrive_buf): New place to hold information about cygdrive. * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Store drive info in pdrive_buf since get_win32_name() could now be too small to hold everything. (fhandler_cygdrive::rewinddir): Reset pdrive to pdrive_buf. (fhandler_cygdrive::closedir): Ditto. * pipe.cc (fhandler_pipe::init): Be more defensive when referencing get_win32_name(). Rework logic which made a copy of the POSIX path and then never used it.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog13
-rw-r--r--winsup/cygwin/cxx.cc2
-rw-r--r--winsup/cygwin/dcrt0.cc2
-rw-r--r--winsup/cygwin/fhandler.h5
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc13
-rwxr-xr-xwinsup/cygwin/libstdcxx_wrapper.cc4
-rw-r--r--winsup/cygwin/path.h2
-rw-r--r--winsup/cygwin/pipe.cc12
8 files changed, 35 insertions, 18 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 04681bee4..7948357ca 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,16 @@
+2009-08-04 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * fhandler.h (fhandler_cygdrive:DRVSZ): New enum.
+ (pdrive_buf): New place to hold information about cygdrive.
+ * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Store drive
+ info in pdrive_buf since get_win32_name() could now be too small to
+ hold everything.
+ (fhandler_cygdrive::rewinddir): Reset pdrive to pdrive_buf.
+ (fhandler_cygdrive::closedir): Ditto.
+ * pipe.cc (fhandler_pipe::init): Be more defensive when referencing
+ get_win32_name(). Rework logic which made a copy of the POSIX path and
+ then never used it.
+
2009-08-02 Christopher Faylor <me+cygwin@cgf.cx>
* sigproc.cc (stopped_or_terminated): Don't return a match when stopsig
diff --git a/winsup/cygwin/cxx.cc b/winsup/cygwin/cxx.cc
index 63262f59e..523fb4268 100644
--- a/winsup/cygwin/cxx.cc
+++ b/winsup/cygwin/cxx.cc
@@ -89,7 +89,7 @@ __cxa_guard_release ()
/* These routines are made available as last-resort fallbacks
for the application. Should not be used in practice. */
-struct per_process_cxx_malloc default_cygwin_cxx_malloc =
+struct per_process_cxx_malloc default_cygwin_cxx_malloc =
{
&(operator new),
&(operator new[]),
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 9cff06f47..e49183796 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -994,7 +994,7 @@ extern "C" void
__main (void)
{
/* Ordering is critical here. DLL ctors have already been
- run as they were being loaded, so we should stack the
+ run as they were being loaded, so we should stack the
queued call to DLL dtors now. */
atexit (dll_global_dtors);
do_global_ctors (user_data->ctors, false);
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 382a592cb..87ae390d7 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -753,8 +753,13 @@ class fhandler_disk_file: public fhandler_base
class fhandler_cygdrive: public fhandler_disk_file
{
+ enum
+ {
+ DRVSZ = sizeof ("x:\\")
+ };
int ndrives;
const char *pdrive;
+ char pdrive_buf[2 * 26 * DRVSZ];
void set_drives ();
public:
fhandler_cygdrive ();
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 2baabaef3..579c6ef21 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -2123,14 +2123,11 @@ fhandler_cygdrive::close ()
return 0;
}
-#define DRVSZ sizeof ("x:\\")
void
fhandler_cygdrive::set_drives ()
{
- const int len = 2 + 26 * DRVSZ;
- char *p = const_cast<char *> (get_win32_name ());
- pdrive = p;
- ndrives = GetLogicalDriveStrings (len, p) / DRVSZ;
+ pdrive = pdrive_buf;
+ ndrives = GetLogicalDriveStrings (sizeof pdrive_buf, pdrive_buf) / DRVSZ;
}
int
@@ -2146,7 +2143,7 @@ fhandler_cygdrive::fstat (struct __stat64 *buf)
for (const char *p = pdrive; p && *p; p = strchr (p, '\0') + 1)
if (is_floppy ((flptst[0] = *p, flptst))
|| GetFileAttributes (p) == INVALID_FILE_ATTRIBUTES)
- --n;
+ n--;
buf->st_nlink = n + 2;
return 0;
}
@@ -2198,13 +2195,13 @@ fhandler_cygdrive::readdir (DIR *dir, dirent *de)
void
fhandler_cygdrive::rewinddir (DIR *dir)
{
- pdrive = get_win32_name ();
+ pdrive = pdrive_buf;
dir->__d_position = 0;
}
int
fhandler_cygdrive::closedir (DIR *dir)
{
- pdrive = get_win32_name ();
+ pdrive = pdrive_buf;
return 0;
}
diff --git a/winsup/cygwin/libstdcxx_wrapper.cc b/winsup/cygwin/libstdcxx_wrapper.cc
index 42d4c5bca..a6492f243 100755
--- a/winsup/cygwin/libstdcxx_wrapper.cc
+++ b/winsup/cygwin/libstdcxx_wrapper.cc
@@ -76,13 +76,13 @@ operator new[](std::size_t sz, const std::nothrow_t &nt) throw()
return (*user_data->cxx_malloc->oper_new___nt) (sz, nt);
}
-extern void
+extern void
operator delete(void *p, const std::nothrow_t &nt) throw()
{
(*user_data->cxx_malloc->oper_delete_nt) (p, nt);
}
-extern void
+extern void
operator delete[](void *p, const std::nothrow_t &nt) throw()
{
(*user_data->cxx_malloc->oper_delete___nt) (p, nt);
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index d499b153a..3e66c19c7 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -211,7 +211,7 @@ class path_conv
PWCHAR get_wide_win32_path (PWCHAR wc);
operator DWORD &() {return fileattr;}
operator int () {return fileattr; }
- path_conv &operator =(path_conv &pc)
+ path_conv &operator =(path_conv& pc)
{
memcpy (this, &pc, sizeof pc);
path = cstrdup (pc.path);
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc
index e8c7070b1..a694bceef 100644
--- a/winsup/cygwin/pipe.cc
+++ b/winsup/cygwin/pipe.cc
@@ -32,13 +32,15 @@ fhandler_pipe::fhandler_pipe ()
int
fhandler_pipe::init (HANDLE f, DWORD a, mode_t mode)
{
- // FIXME: Have to clean this up someday
- if (!*get_win32_name () && get_name ())
+ /* FIXME: Have to clean this up someday
+ FIXME: Do we have to check for both !get_win32_name() and
+ !*get_win32_name()? */
+ if ((!get_win32_name () || !*get_win32_name ()) && get_name ())
{
+ char *d;
+ const char *s;
char *hold_normalized_name = (char *) alloca (strlen (get_name ()) + 1);
- strcpy (hold_normalized_name, get_name ());
- char *s, *d;
- for (s = hold_normalized_name, d = (char *) get_win32_name (); *s; s++, d++)
+ for (s = get_name (), d = hold_normalized_name; *s; s++, d++)
if (*s == '/')
*d = '\\';
else