summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-02-03 22:00:30 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-02-03 22:00:30 +0000
commitd90b74e07b09f87ebbef141b7af6f5adc6093d8e (patch)
treec152ca91b90ae904024423c811aafb5d8693e5f6
parent2003-02-03 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-d90b74e07b09f87ebbef141b7af6f5adc6093d8e.tar.bz2
2003-02-03 Till Straumann <strauman@slac.stanford.edu>
PR 339/filesystem * src/chroot.c: Fix violation of FS node object copy semantics.
-rw-r--r--cpukit/libcsupport/ChangeLog5
-rw-r--r--cpukit/libcsupport/src/chroot.c11
2 files changed, 12 insertions, 4 deletions
diff --git a/cpukit/libcsupport/ChangeLog b/cpukit/libcsupport/ChangeLog
index 93adbe6e70..84d1cf0726 100644
--- a/cpukit/libcsupport/ChangeLog
+++ b/cpukit/libcsupport/ChangeLog
@@ -1,3 +1,8 @@
+2003-02-03 Till Straumann <strauman@slac.stanford.edu>
+
+ PR 339/filesystem
+ * src/chroot.c: Fix violation of FS node object copy semantics.
+
2003-01-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Eliminate OBJS.
diff --git a/cpukit/libcsupport/src/chroot.c b/cpukit/libcsupport/src/chroot.c
index 95124a43c0..357e328992 100644
--- a/cpukit/libcsupport/src/chroot.c
+++ b/cpukit/libcsupport/src/chroot.c
@@ -38,14 +38,17 @@ int chroot(
rtems_set_errno_and_return_minus_one( ENOTSUP );
};
- loc = rtems_filesystem_root; /* save the value */
-
result = chdir(pathname);
if (result) {
- rtems_filesystem_root = loc; /* restore the value */
rtems_set_errno_and_return_minus_one( errno );
};
- rtems_filesystem_root = rtems_filesystem_current;
+ /* clone the new root location */
+ if (rtems_filesystem_evaluate_path(".", 0, &loc, 0)) {
+ /* our cwd has changed, though - but there is no easy way of return :-( */
+ rtems_set_errno_and_return_minus_one( errno );
+ }
+ rtems_filesystem_freenode(&rtems_filesystem_root);
+ rtems_filesystem_root = loc;
return 0;
}