diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-03-02 10:18:10 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-03-13 12:23:44 +0100 |
commit | 3ba4f828e45141e9428a2c06d3d7c4bec3d5b404 (patch) | |
tree | f790e1259ffa11da3f993e58d2ceeb152b4133f3 /cpukit/libcsupport/src/fchmod.c | |
parent | Filesystem: Reference counting for locations (diff) | |
download | rtems-3ba4f828e45141e9428a2c06d3d7c4bec3d5b404.tar.bz2 |
Filesystem: Read-only file system checks
o Make sure EROFS is indicated for write operations on a read-only file
system.
o Add error indication for read-only file systems in fchmod() and
fchown() according to POSIX.
Diffstat (limited to 'cpukit/libcsupport/src/fchmod.c')
-rw-r--r-- | cpukit/libcsupport/src/fchmod.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cpukit/libcsupport/src/fchmod.c b/cpukit/libcsupport/src/fchmod.c index e651066a77..14fb416f68 100644 --- a/cpukit/libcsupport/src/fchmod.c +++ b/cpukit/libcsupport/src/fchmod.c @@ -28,9 +28,14 @@ int fchmod( int fd, mode_t mode ) iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); - rtems_filesystem_instance_lock( &iop->pathinfo ); - rv = (*iop->pathinfo.ops->fchmod_h)( &iop->pathinfo, mode ); - rtems_filesystem_instance_unlock( &iop->pathinfo ); + if (iop->pathinfo.mt_entry->writeable) { + rtems_filesystem_instance_lock( &iop->pathinfo ); + rv = (*iop->pathinfo.ops->fchmod_h)( &iop->pathinfo, mode ); + rtems_filesystem_instance_unlock( &iop->pathinfo ); + } else { + errno = EROFS; + rv = -1; + } return rv; } |