[rtems commit] ftpd: Set current directory after session close

Sebastian Huber sebh at rtems.org
Tue May 29 14:15:51 UTC 2012


Module:    rtems
Branch:    master
Commit:    4da3fef4553dd294bdaa0994e9bd5b99ff48e2e1
Changeset: http://git.rtems.org/rtems/commit/?id=4da3fef4553dd294bdaa0994e9bd5b99ff48e2e1

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue May 29 16:11:46 2012 +0200

ftpd: Set current directory after session close

The chroot() is an implicit chdir("/").  Set the current directory to
"/" after session close.  This helps to avoid references to mounted file
systems in dynamic media.

---

 cpukit/ftpd/ftpd.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/cpukit/ftpd/ftpd.c b/cpukit/ftpd/ftpd.c
index 2668c29..905f40c 100644
--- a/cpukit/ftpd/ftpd.c
+++ b/cpukit/ftpd/ftpd.c
@@ -1890,7 +1890,6 @@ session(rtems_task_argument arg)
       &set);
 
     chroot_made = chroot_made || chroot(ftpd_root) == 0;
-    chdir("/");
 
     errno = 0;
 
@@ -1926,6 +1925,8 @@ session(rtems_task_argument arg)
     free(info->user);
     free(info->pass);
     task_pool_release(info);
+
+    chdir("/");
   }
 }
 




More information about the vc mailing list