summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-08-11 20:04:27 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-08-11 20:04:27 +0000
commitdd19c0bb061af5595a970ed3c4f4af3824b65593 (patch)
treef946b796fc8e82900702a771e6f6c6b39cbe2297 /cpukit/libcsupport/src
parent2000-08-11 Charles-Antoine Gauthier <charles.gauthier@nrc.ca> (diff)
downloadrtems-dd19c0bb061af5595a970ed3c4f4af3824b65593.tar.bz2
2000-08-11 Chris Johns <ccj@acm.org>
* libc/chmod.c: Return ENOTSUP if filesystem does not have handler. * libc/eval.c: Ditto. * libc/fcntl.c: Ditto. * libc/fsync.c: Ditto. * libc/ioctl.c: Ditto. * libc/ioman.c: Ditto. * libc/link.c: Ditto. * libc/memfile.c: Ditto. * libc/mknod.c: Ditto. * libc/symlink.c: Ditto. * libc/libio.h(rtems_filesystem_dev_major_t): New macro. * libc/libio.h(rtems_filesystem_dev_minor_t): New macro.
Diffstat (limited to 'cpukit/libcsupport/src')
-rw-r--r--cpukit/libcsupport/src/chmod.c5
-rw-r--r--cpukit/libcsupport/src/eval.c3
-rw-r--r--cpukit/libcsupport/src/fcntl.c14
-rw-r--r--cpukit/libcsupport/src/fsync.c3
-rw-r--r--cpukit/libcsupport/src/ioctl.c3
-rw-r--r--cpukit/libcsupport/src/link.c8
-rw-r--r--cpukit/libcsupport/src/mknod.c5
-rw-r--r--cpukit/libcsupport/src/symlink.c5
8 files changed, 42 insertions, 4 deletions
diff --git a/cpukit/libcsupport/src/chmod.c b/cpukit/libcsupport/src/chmod.c
index d88e80eeb7..f1042806b9 100644
--- a/cpukit/libcsupport/src/chmod.c
+++ b/cpukit/libcsupport/src/chmod.c
@@ -33,6 +33,11 @@ int chmod(
if ( status != 0 )
return -1;
+ if ( !loc.handlers ){
+ rtems_filesystem_freenode( &loc );
+ set_errno_and_return_minus_one( EBADF );
+ }
+
if ( !loc.handlers->fchmod ){
rtems_filesystem_freenode( &loc );
set_errno_and_return_minus_one( ENOTSUP );
diff --git a/cpukit/libcsupport/src/eval.c b/cpukit/libcsupport/src/eval.c
index 8fc27ca19c..8d839918a5 100644
--- a/cpukit/libcsupport/src/eval.c
+++ b/cpukit/libcsupport/src/eval.c
@@ -43,6 +43,9 @@ int rtems_filesystem_evaluate_path(
rtems_filesystem_get_start_loc( pathname, &i, pathloc );
+ if ( !pathloc->ops->evalpath )
+ set_errno_and_return_minus_one( ENOTSUP );
+
result = (*pathloc->ops->evalpath)( &pathname[i], flags, pathloc );
/*
diff --git a/cpukit/libcsupport/src/fcntl.c b/cpukit/libcsupport/src/fcntl.c
index 05410eaff6..587726f885 100644
--- a/cpukit/libcsupport/src/fcntl.c
+++ b/cpukit/libcsupport/src/fcntl.c
@@ -131,10 +131,16 @@ int fcntl(
ret = -1;
break;
}
- if ((ret >= 0) && iop->handlers->fcntl) {
- int err = (*iop->handlers->fcntl)( cmd, iop );
- if (err) {
- errno = err;
+ if (ret >= 0) {
+ if (iop->handlers->fcntl) {
+ int err = (*iop->handlers->fcntl)( cmd, iop );
+ if (err) {
+ errno = err;
+ ret = -1;
+ }
+ }
+ else {
+ errno = ENOTSUP;
ret = -1;
}
}
diff --git a/cpukit/libcsupport/src/fsync.c b/cpukit/libcsupport/src/fsync.c
index 64f05f341a..3dc9835d31 100644
--- a/cpukit/libcsupport/src/fsync.c
+++ b/cpukit/libcsupport/src/fsync.c
@@ -30,6 +30,9 @@ int fsync(
* Now process the fsync().
*/
+ if ( !iop->handlers )
+ set_errno_and_return_minus_one( EBADF );
+
if ( !iop->handlers->fsync )
set_errno_and_return_minus_one( ENOTSUP );
diff --git a/cpukit/libcsupport/src/ioctl.c b/cpukit/libcsupport/src/ioctl.c
index 8d84a26a15..ce74ba7cf4 100644
--- a/cpukit/libcsupport/src/ioctl.c
+++ b/cpukit/libcsupport/src/ioctl.c
@@ -41,6 +41,9 @@ int ioctl(
* Now process the ioctl().
*/
+ if ( !iop->handlers )
+ set_errno_and_return_minus_one( EBADF );
+
if ( !iop->handlers->ioctl )
set_errno_and_return_minus_one( ENOTSUP );
diff --git a/cpukit/libcsupport/src/link.c b/cpukit/libcsupport/src/link.c
index 5bf8f90353..03bdaee343 100644
--- a/cpukit/libcsupport/src/link.c
+++ b/cpukit/libcsupport/src/link.c
@@ -41,8 +41,16 @@ int link(
*/
rtems_filesystem_get_start_loc( new, &i, &parent_loc );
+
+ if ( !parent_loc.ops->evalformake ) {
+ rtems_filesystem_freenode( &existing_loc );
+ rtems_filesystem_freenode( &parent_loc );
+ set_errno_and_return_minus_one( ENOTSUP );
+ }
+
result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
if ( result != 0 ) {
+ rtems_filesystem_freenode( &existing_loc );
rtems_filesystem_freenode( &parent_loc );
set_errno_and_return_minus_one( result );
}
diff --git a/cpukit/libcsupport/src/mknod.c b/cpukit/libcsupport/src/mknod.c
index 0a3a108f9a..30a3f548a2 100644
--- a/cpukit/libcsupport/src/mknod.c
+++ b/cpukit/libcsupport/src/mknod.c
@@ -43,6 +43,11 @@ int mknod(
rtems_filesystem_get_start_loc( pathname, &i, &temp_loc );
+ if ( !temp_loc.ops->evalformake ) {
+ rtems_filesystem_freenode( &temp_loc );
+ set_errno_and_return_minus_one( ENOTSUP );
+ }
+
result = (*temp_loc.ops->evalformake)(
&pathname[i],
&temp_loc,
diff --git a/cpukit/libcsupport/src/symlink.c b/cpukit/libcsupport/src/symlink.c
index 6a31a25bad..c63abf0a25 100644
--- a/cpukit/libcsupport/src/symlink.c
+++ b/cpukit/libcsupport/src/symlink.c
@@ -28,6 +28,11 @@ int symlink(
if ( result != 0 )
return -1;
+ if ( !loc.ops->symlink ) {
+ rtems_filesystem_freenode( &loc );
+ set_errno_and_return_minus_one( ENOTSUP );
+ }
+
result = (*loc.ops->symlink)( &loc, actualpath, name_start);
rtems_filesystem_freenode( &loc );