aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-06-10 10:00:21 +0000
committerCorinna Vinschen <corinna@vinschen.de>2001-06-10 10:00:21 +0000
commit463513f0e2cfa15ebebb5df41ea13b324f83934b (patch)
treee5b0af3c4b9c47efdcfcefece96bbe4fbf461371 /winsup
parentd4217d5680a5fbec07a49c5921b41ccb886e635a (diff)
downloadnewlib-463513f0e2cfa15ebebb5df41ea13b324f83934b.zip
newlib-463513f0e2cfa15ebebb5df41ea13b324f83934b.tar.gz
newlib-463513f0e2cfa15ebebb5df41ea13b324f83934b.tar.bz2
* cygwin.din: Add fchdir symbols.
* path.cc (chdir): Guard against invalid parameter. (fchdir): New function. * include/cygwin/version.h: Bump API minor version to 40. * uinfo.cc (internal_getlogin): Remove unused variable.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/cygwin.din2
-rw-r--r--winsup/cygwin/include/cygwin/version.h3
-rw-r--r--winsup/cygwin/path.cc32
-rw-r--r--winsup/cygwin/uinfo.cc1
5 files changed, 36 insertions, 10 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index c0a87d5..45df8de 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,11 @@
+Sun Jun 10 11:56:00 2001 Corinna Vinschen <corinna@vinschen.de>
+
+ * cygwin.din: Add fchdir symbols.
+ * path.cc (chdir): Guard against invalid parameter.
+ (fchdir): New function.
+ * include/cygwin/version.h: Bump API minor version to 40.
+ * uinfo.cc (internal_getlogin): Remove unused variable.
+
Sat Jun 9 23:20:00 2001 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (seteuid): Set environment variables USERNAME and
diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din
index a3e8127..0807954 100644
--- a/winsup/cygwin/cygwin.din
+++ b/winsup/cygwin/cygwin.din
@@ -191,6 +191,8 @@ _f_atan2
__f_atan2 = _f_atan2
_f_atan2f
__f_atan2f = _f_atan2f
+fchdir
+_fchdir = fchdir
fchmod
_fchmod = fchmod
fchown
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
index 6c83ad4..d7f34d8 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -133,10 +133,11 @@ details. */
37: [f]pathconv support _PC_POSIX_PERMISSIONS and _PC_POSIX_SECURITY
38: vscanf, vscanf_r, and random pthread functions
39: asctime_r, ctime_r, gmtime_r, localtime_r
+ 40: fchdir
*/
#define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 39
+#define CYGWIN_VERSION_API_MINOR 40
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 76a0098..5dd13f6 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2994,8 +2994,14 @@ int
chdir (const char *dir)
{
MALLOC_CHECK;
- syscall_printf ("dir %s", dir);
path_conv path (dir, PC_FULL | PC_SYM_FOLLOW);
+ if (path.error)
+ {
+ set_errno (path.error);
+ syscall_printf ("-1 = chdir (%s)", dir);
+ return -1;
+ }
+ syscall_printf ("dir %s", dir);
char *s;
/* Incredibly. Windows allows you to specify a path with trailing
@@ -3005,13 +3011,6 @@ chdir (const char *dir)
for (s = strchr (dir, '\0'); --s >= dir && isspace ((unsigned int) (*s & 0xff)); )
*s = '\0';
- if (path.error)
- {
- set_errno (path.error);
- syscall_printf ("-1 = chdir (%s)", dir);
- return -1;
- }
-
/* Look for trailing path component consisting entirely of dots. This
is needed only in case of chdir since Windows simply ignores count
of dots > 2 here instead of returning an error code. Counts of dots
@@ -3068,6 +3067,23 @@ chdir (const char *dir)
return res;
}
+extern "C"
+int
+fchdir (int fd)
+{
+ sigframe thisframe (mainthread);
+
+ if (cygheap->fdtab.not_open (fd))
+ {
+ syscall_printf ("-1 = fchdir (%d)", fd);
+ set_errno (EBADF);
+ return -1;
+ }
+ int ret = chdir (cygheap->fdtab[fd]->get_name ());
+ syscall_printf ("%d = fchdir (%d)", ret, fd);
+ return ret;
+}
+
/******************** Exported Path Routines *********************/
/* Cover functions to the path conversion routines.
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 867f3ce..32bc260 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -153,7 +153,6 @@ internal_getlogin (cygheap_user &user)
cygsid gsid (NO_SID);
if (ret)
{
- char dom[INTERNET_MAX_HOST_NAME_LENGTH + 1];
cygsid psid;
for (int pidx = 0; (pw = internal_getpwent (pidx)); ++pidx)