source: rtems/c/src/lib/libc/chroot.c @ 37535317

4.104.114.84.95
Last change on this file since 37535317 was 37535317, checked in by Joel Sherrill <joel.sherrill@…>, on Jan 26, 2001 at 2:12:48 PM

2001-01-25 Joel Sherrill <joel@…>

  • cpu.c, rtems/score/cpu.h: Bug report from Peter Mueller <peter.o.mueller@…> because of not correcting for the ISR vector table now being allocated from the workspace.
  • Property mode set to 100644
File size: 1.3 KB
Line 
1/* 
2 *  chroot() -  Change Root Directory
3 *  Author: fernando.ruiz@ctv.es
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems.h>
20
21#include <unistd.h>
22#include <errno.h>
23
24#include <rtems/libio_.h>
25
26int chroot(
27  const char *pathname
28)
29{
30  int                               result;
31  rtems_filesystem_location_info_t  loc;
32 
33  if (rtems_current_user_env == &rtems_global_user_env)
34    set_errno_and_return_minus_one( ENOTSUP );
35
36  loc = rtems_filesystem_root;i    /* save the value */
37
38  /* if has been already changed */
39  rtems_filesystem_root = rtems_global_user_env.filesystem_root;
40
41  result = chdir(pathname);
42  if (result) {
43    rtems_filesystem_root = loc; /* restore the value */
44    set_errno_and_return_minus_one( errno );
45  };
46  rtems_filesystem_root = rtems_filesystem_current;
47
48  result = chdir("/");
49  if (result) {
50    rtems_filesystem_root = loc; /* restore the value */
51    set_errno_and_return_minus_one( errno );
52  };
53
54  /*XXX : Call this? Sorry but I don't known if it is necesary */
55  /* The old root.
56   rtems_filesystem_freenode( &loc );
57   */
58  return 0;
59}
Note: See TracBrowser for help on using the repository browser.