#1283 closed defect (duplicate)

IMFS: Symbolic links

Reported by: Sebastian Huber Owned by: Joel Sherrill
Priority: normal Milestone: 4.9
Component: score Version: 4.9
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

I got a compiler warning: cpukit/libfs/src/imfs/imfs_rmnod.c:76: warning: passing argument 1 of 'free' discards qualifiers from pointer target type

That is because of (imfs.h):
typedef struct {

const char *name;

} IMFS_sym_link_t;

Since the symbolic link name will be allocated from the heap this may be changed to:
typedef struct {

char *name;

} IMFS_sym_link_t;

This leads to an explicit cast in IMFS_symlink:

/*

  • It is ok to cast the const qualifier away since IMFS_create_node copies
  • the link name. */

info.sym_link.name = (char *) link_name;

One problem remains: In IMFS_create_node the return value calloc() of the symbolic name will not be checked.

Change History (1)

comment:1 Changed on Apr 24, 2008 at 1:13:26 PM by Sebastian Huber

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.