aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-05-22 22:09:58 +0000
committerChristopher Faylor <me@cgf.cx>2002-05-22 22:09:58 +0000
commitfc240f584b02d8bb1a2bb60927c3d13b583c68a1 (patch)
treee2905ee758c0cb0d17479f6422fedc4f84352e1d /winsup/cygwin
parent41dc93916139473204dcfeea91cefbdf8f696301 (diff)
downloadnewlib-fc240f584b02d8bb1a2bb60927c3d13b583c68a1.zip
newlib-fc240f584b02d8bb1a2bb60927c3d13b583c68a1.tar.gz
newlib-fc240f584b02d8bb1a2bb60927c3d13b583c68a1.tar.bz2
* fhandler.h (fhandler_virtual::exists): Eliminate path argument.
(fhandler_proc::exists): Ditto. (fhandler_registry::exists): Ditto. (fhandler_process::exists): Ditto. * fhandler_proc.cc (fhandler_proc::exists): Ditto. Use built-in name. * fhandler_process.cc (fhandler_process::exists): Ditto. (fstat): Ditto. * fhandler_registry.cc (fhandler_registry::exists): Ditto. (fhandler_registry::fstat): Ditto. * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto. * path.cc (path_conv::check): Ditto. Add debugging. * syscalls.cc (dup): Always call dup2 for error handling.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog22
-rw-r--r--winsup/cygwin/fhandler.h8
-rw-r--r--winsup/cygwin/fhandler_proc.cc3
-rw-r--r--winsup/cygwin/fhandler_process.cc5
-rw-r--r--winsup/cygwin/fhandler_registry.cc5
-rw-r--r--winsup/cygwin/fhandler_virtual.cc4
-rw-r--r--winsup/cygwin/path.cc7
-rw-r--r--winsup/cygwin/syscalls.cc10
8 files changed, 40 insertions, 24 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 8744708..592a8cc 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,21 @@
+2002-05-22 Christopher Faylor <cgf@redhat.com>
+
+ * fhandler.h (fhandler_virtual::exists): Eliminate path argument.
+ (fhandler_proc::exists): Ditto.
+ (fhandler_registry::exists): Ditto.
+ (fhandler_process::exists): Ditto.
+ * fhandler_proc.cc (fhandler_proc::exists): Ditto. Use built-in name.
+ * fhandler_process.cc (fhandler_process::exists): Ditto.
+ (fstat): Ditto.
+ * fhandler_registry.cc (fhandler_registry::exists): Ditto.
+ (fhandler_registry::fstat): Ditto.
+ * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto.
+ * path.cc (path_conv::check): Ditto. Add debugging.
+
+2002-05-22 Christopher Faylor <cgf@redhat.com>
+
+ * syscalls.cc (dup): Always call dup2 for error handling.
+
2002-05-22 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/types.h: Revert previous patch.
@@ -9,7 +27,7 @@
2002-05-19 Pierre Humblet <pierre.humblet@ieee.org>
- * security.cc (open_local_policy): Initialize lsa to
+ * security.cc (open_local_policy): Initialize lsa to
INVALID_HANDLE_VALUE instead of NULL.
(get_logon_server_and_user_domain): Test for INVALID_HANDLE_VALUE
instead of NULL.
@@ -70,7 +88,7 @@
* cygwin.din: Add strlcat and strlcpy.
* include/cygwin/version.h: Increment API minor version number.
-2002-05-09 Pierre Humblet <pierre.humblet@ieee.org>
+2002-05-09 Pierre Humblet <pierre.humblet@ieee.org>
* shared.cc (__sec_user): Split into sec_acl() and call orig_sid().
(sec_acl): Create from part of __sec_user(), except creator/owner.
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index bafcefa..a30364b 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1051,7 +1051,7 @@ class fhandler_virtual : public fhandler_base
fhandler_virtual (DWORD devtype);
virtual ~fhandler_virtual();
- virtual int exists(const char *path);
+ virtual int exists();
DIR *opendir (path_conv& pc);
__off64_t telldir (DIR *);
void seekdir (DIR *, __off64_t);
@@ -1072,7 +1072,7 @@ class fhandler_proc: public fhandler_virtual
public:
fhandler_proc ();
fhandler_proc (DWORD devtype);
- int exists(const char *path);
+ int exists();
struct dirent *readdir (DIR *);
static DWORD get_proc_fhandler(const char *path);
@@ -1085,7 +1085,7 @@ class fhandler_registry: public fhandler_proc
{
public:
fhandler_registry ();
- int exists(const char *path);
+ int exists();
struct dirent *readdir (DIR *);
__off64_t telldir (DIR *);
void seekdir (DIR *, __off64_t);
@@ -1106,7 +1106,7 @@ class fhandler_process: public fhandler_proc
_pinfo *saved_p;
public:
fhandler_process ();
- int exists(const char *path);
+ int exists();
struct dirent *readdir (DIR *);
int open (path_conv *real_path, int flags, mode_t mode = 0);
int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
index 60e9578..3b2878b 100644
--- a/winsup/cygwin/fhandler_proc.cc
+++ b/winsup/cygwin/fhandler_proc.cc
@@ -135,8 +135,9 @@ fhandler_proc::get_proc_fhandler (const char *path)
* <0 if path is a file.
*/
int
-fhandler_proc::exists (const char *path)
+fhandler_proc::exists ()
{
+ const char *path = get_name ();
debug_printf ("exists (%s)", path);
path += proc_len;
if (*path == 0)
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index f374d4d..0ad7294 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -74,8 +74,9 @@ static bool get_mem_values(DWORD dwProcessId, unsigned long *vmsize, unsigned lo
* <0 if path is a file.
*/
int
-fhandler_process::exists (const char *path)
+fhandler_process::exists ()
{
+ const char *path = get_name ();
debug_printf ("exists (%s)", path);
path += proc_len + 1;
while (*path != 0 && !SLASH_P (*path))
@@ -98,7 +99,7 @@ int
fhandler_process::fstat (struct __stat64 *buf, path_conv *pc)
{
const char *path = get_name ();
- int file_type = exists (path);
+ int file_type = exists ();
(void) fhandler_base::fstat (buf, pc);
path += proc_len + 1;
int pid = atoi (path);
diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc
index 4fc5024..186dfa4 100644
--- a/winsup/cygwin/fhandler_registry.cc
+++ b/winsup/cygwin/fhandler_registry.cc
@@ -93,7 +93,7 @@ static const char *DEFAULT_VALUE_NAME = "@";
* to the final key in the path.
*/
int
-fhandler_registry::exists (const char *path)
+fhandler_registry::exists ()
{
int file_type = 0, index = 0, pathlen;
DWORD buf_size = MAX_PATH;
@@ -102,6 +102,7 @@ fhandler_registry::exists (const char *path)
const char *file;
HKEY hKey = (HKEY) INVALID_HANDLE_VALUE;
+ const char *path = get_name ();
debug_printf ("exists (%s)", path);
path += proc_len + 1 + registry_len;
@@ -187,7 +188,7 @@ fhandler_registry::fstat (struct __stat64 *buf, path_conv *pc)
{
this->fhandler_base::fstat (buf, pc);
buf->st_mode &= ~_IFMT & NO_W;
- int file_type = exists (get_name ());
+ int file_type = exists ();
switch (file_type)
{
case 0:
diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc
index 96925e5..500bfb3 100644
--- a/winsup/cygwin/fhandler_virtual.cc
+++ b/winsup/cygwin/fhandler_virtual.cc
@@ -46,7 +46,7 @@ fhandler_virtual::opendir (path_conv& pc)
DIR *res = NULL;
size_t len;
- if (exists (get_name ()) <= 0)
+ if (exists () <= 0)
set_errno (ENOTDIR);
else if ((len = strlen (get_name ())) > MAX_PATH - 3)
set_errno (ENAMETOOLONG);
@@ -216,7 +216,7 @@ fhandler_virtual::open (path_conv *, int flags, mode_t mode)
}
int
-fhandler_virtual::exists (const char *path)
+fhandler_virtual::exists ()
{
return 0;
}
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 3c2be69..2f2c19b 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -520,7 +520,7 @@ path_conv::check (const char *src, unsigned opt,
/* FIXME: Calling build_fhandler here is not the right way to handle this. */
fhandler_virtual *fh =
(fhandler_virtual *) cygheap->fdtab.build_fhandler (-1, devn, path_copy, NULL, unit);
- int file_type = fh->exists (path_copy);
+ int file_type = fh->exists ();
switch (file_type)
{
case 1:
@@ -725,7 +725,10 @@ path_conv::check (const char *src, unsigned opt,
out:
if (opt & PC_POSIX)
- normalized_path = cstrdup (path_copy);
+ {
+ normalized_path = cstrdup (path_copy);
+ debug_printf ("path_copy %s", path_copy);
+ }
/* Deal with Windows stupidity which considers filename\. to be valid
even when "filename" is not a directory. */
if (!need_directory || error)
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 2eb0901..24d44bb 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -83,15 +83,7 @@ check_pty_fds (void)
int
dup (int fd)
{
- int res;
- cygheap_fdnew newfd;
-
- if (newfd < 0)
- res = -1;
- else
- res = dup2 (fd, newfd);
-
- return res;
+ return cygheap->fdtab.dup2 (fd, cygheap_fdnew ());
}
int