source: rtems/c/src/lib/libc/imfs_symlink.c @ fcee56c0

4.104.114.84.95
Last change on this file since fcee56c0 was 3cf8394, checked in by Joel Sherrill <joel.sherrill@…>, on 02/24/99 at 20:58:47

Changed IMFS to use IMFS_NAME_MAX as the maximum length of a basename
rather then NAME_MAX. NAME_MAX is 255 and that lets IMFS chew up memory
too fast. Perhaps in the future, the places in IMFS that put a maximum
length name string on the stack and the jnode structure does not include
a maximu length name string can be fixed so this is not a problem.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  IMFS_symlink
3 *
4 *  The following rouine creates a new symbolic link node under parent
5 *  with the name given in name.  The node is set to point to the node at
6 *  to_loc.
7 *
8 *  COPYRIGHT (c) 1989-1998.
9 *  On-Line Applications Research Corporation (OAR).
10 *  Copyright assigned to U.S. Government, 1994.
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.OARcorp.com/rtems/license.html.
15 *
16 *  $Id$
17 */
18
19#include <errno.h>
20#include "imfs.h"
21#include "libio_.h"
22
23int IMFS_symlink(
24  rtems_filesystem_location_info_t  *parent_loc,
25  const char                        *link_name,
26  const char                        *node_name
27)
28{
29  IMFS_types_union   info;
30  IMFS_jnode_t      *new_node;
31  char               new_name[ IMFS_NAME_MAX + 1 ];
32  int                i;
33
34  /*
35   * Remove any separators at the end of the string.
36   */
37
38  IMFS_get_token( node_name, new_name, &i );
39
40  info.sym_link.name = link_name;
41
42  /*
43   *  Create a new link node.
44   */
45
46  new_node = IMFS_create_node(
47    parent_loc,
48    IMFS_SYM_LINK,
49    new_name,
50    ( S_IFLNK | ( S_IRWXU | S_IRWXG | S_IRWXO )),
51    &info
52  );
53
54  if ( !new_node )
55    set_errno_and_return_minus_one( ENOMEM );
56
57  return 0;
58}
59
60
Note: See TracBrowser for help on using the repository browser.