aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-12-26 02:10:30 +0000
committerChristopher Faylor <me@cgf.cx>2004-12-26 02:10:30 +0000
commit8711eddd80efc5f05f19da613ce3ad7ebc66aa35 (patch)
tree89fa306d8a4bd626b9e23af318788c18c07efcd7 /winsup/cygwin
parent9a3412eea8a2aa2daafa031f2e94f7049c1de202 (diff)
downloadnewlib-8711eddd80efc5f05f19da613ce3ad7ebc66aa35.zip
newlib-8711eddd80efc5f05f19da613ce3ad7ebc66aa35.tar.gz
newlib-8711eddd80efc5f05f19da613ce3ad7ebc66aa35.tar.bz2
* fhandler.cc (fhandler_base::fchmod): Do the right thing when changing an "on
disk" device or fifo. (fhandler_base::fchown): Ditto for changing ownership. * fhandler_disk_file.cc (fhandler_base::fstat_helper): Accommodate device files on ntfs partitions. * path.cc (path_conv::check): Use isfs function to figure out if a path exists on a filesystem to make sure that device files are caught.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/fhandler.cc5
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc9
-rw-r--r--winsup/cygwin/path.cc2
-rw-r--r--winsup/cygwin/pinfo.cc1
5 files changed, 24 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4e341a9..4ae5c13 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,13 @@
+2004-12-25 Christopher Faylor <cgf@timesys.com>
+
+ * fhandler.cc (fhandler_base::fchmod): Do the right thing when changing
+ an "on disk" device or fifo.
+ (fhandler_base::fchown): Ditto for changing ownership.
+ * fhandler_disk_file.cc (fhandler_base::fstat_helper): Accommodate
+ device files on ntfs partitions.
+ * path.cc (path_conv::check): Use isfs function to figure out if a path
+ exists on a filesystem to make sure that device files are caught.
+
2004-12-24 Christopher Faylor <cgf@timesys.com>
* child_info.h (CURR_CHILD_INFO_MAGIC): Update.
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 2507f32..61f9cc0 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1520,6 +1520,9 @@ fhandler_base::closedir (DIR *)
int
fhandler_base::fchmod (mode_t mode)
{
+ extern int chmod_device (path_conv& pc, mode_t mode);
+ if (pc.is_fs_special ())
+ return chmod_device (pc, mode);
/* By default, just succeeds. */
return 0;
}
@@ -1527,6 +1530,8 @@ fhandler_base::fchmod (mode_t mode)
int
fhandler_base::fchown (__uid32_t uid, __gid32_t gid)
{
+ if (pc.is_fs_special ())
+ return ((fhandler_disk_file *) this)->fhandler_disk_file::fchown (uid, gid);
/* By default, just succeeds. */
return 0;
}
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index ebf9277..7fc6a14 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -300,8 +300,15 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
if (pc.has_attribute (FILE_ATTRIBUTE_READONLY) && !pc.issymlink ())
buf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
- if (!(buf->st_mode & S_IFMT))
+ if (buf->st_mode & S_IFMT)
+ /* nothing */;
+ else if (!is_fs_special ())
buf->st_mode |= S_IFREG;
+ else
+ {
+ buf->st_dev = dev ();
+ buf->st_mode = dev ().mode;
+ }
}
else
{
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 7716f02..0e8aa97 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -816,7 +816,7 @@ out:
return;
}
- if (dev.devn == FH_FS)
+ if (dev.isfs ())
{
if (strncmp (path, "\\\\.\\", 4))
{
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 69a4380..1bf6b5e 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -71,7 +71,6 @@ set_myself (HANDLE h)
ForceCloseHandle (cygheap->pid_handle);
cygheap->pid_handle = NULL;
}
- return;
}
/* Initialize the process table entry for the current task.