summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-04-04 12:45:24 +0000
committerCorinna Vinschen <corinna@vinschen.de>2012-04-04 12:45:24 +0000
commitffcd2c3f894413870b4431677d94044ca0336c1b (patch)
tree2583b53962456dc70c128da496312eb5106e7fa4
parentce508e512aa91b03dfe35e20182f4b80ebde135c (diff)
downloadcygnal-ffcd2c3f894413870b4431677d94044ca0336c1b.tar.gz
cygnal-ffcd2c3f894413870b4431677d94044ca0336c1b.tar.bz2
cygnal-ffcd2c3f894413870b4431677d94044ca0336c1b.zip
* fhandler_nodevice.cc (fhandler_nodevice::open): Convert EROFS to
ENOENT if non-existent file got opened for reading only. Explain why. * path.cc (path_conv::check): Stick to ENOENT if file has been opened for informational purposes only. Add to comment.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/fhandler_nodevice.cc6
-rw-r--r--winsup/cygwin/path.cc7
3 files changed, 17 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 5ebc53dc1..57f411250 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
2012-04-04 Corinna Vinschen <corinna@vinschen.de>
+ * fhandler_nodevice.cc (fhandler_nodevice::open): Convert EROFS to
+ ENOENT if non-existent file got opened for reading only. Explain why.
+ * path.cc (path_conv::check): Stick to ENOENT if file has been opened
+ for informational purposes only. Add to comment.
+
+2012-04-04 Corinna Vinschen <corinna@vinschen.de>
+
* path.cc (path_conv::check): Convert device type to FH_FS for
non-existant files on /dev, unless /dev itself doesn't exist on disk.
Add comment to explain why.
diff --git a/winsup/cygwin/fhandler_nodevice.cc b/winsup/cygwin/fhandler_nodevice.cc
index 4ffe2c447..39842d394 100644
--- a/winsup/cygwin/fhandler_nodevice.cc
+++ b/winsup/cygwin/fhandler_nodevice.cc
@@ -15,10 +15,14 @@ details. */
#include "fhandler.h"
int
-fhandler_nodevice::open (int, mode_t)
+fhandler_nodevice::open (int flags, mode_t)
{
if (!pc.error)
set_errno (ENXIO);
+ /* Fixup EROFS error returned from path_conv if /dev is not backed by real
+ directory on disk and the file doesn't exist. */
+ else if (pc.error == EROFS && (flags & O_ACCMODE) == O_RDONLY)
+ set_errno (ENOENT);
return 0;
}
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 4fee713ae..6c848fc6f 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -889,8 +889,11 @@ is_virtual_symlink:
subsequent code handles the file correctly.
Unless /dev itself doesn't exist on disk. In that case /dev
is handled as virtual filesystem, and virtual filesystems are
- read-only. */
- if (sym.error == ENOENT)
+ read-only. The PC_KEEP_HANDLE check allows to check for
+ a call from an informational system call. In that case we
+ just stick to ENOENT, and the device type doesn't matter
+ anyway. */
+ if (sym.error == ENOENT && !(opt & PC_KEEP_HANDLE))
sym.error = EROFS;
else
dev.d.devn = FH_FS;