source: rtems/c/src/exec/libcsupport/src/chmod.c @ c7016198

4.104.114.84.95
Last change on this file since c7016198 was dd0f326, checked in by Joel Sherrill <joel.sherrill@…>, on 10/12/99 at 19:10:46

Added rtems_filesystem_freenode() macro and added calls at appropriate
places to make sure memory allocated for filesystem specifif nodes
gets freed.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/*
2 *  chmod() - POSIX 1003.1b 5.6.4 - Change File Modes
3 *
4 *  COPYRIGHT (c) 1989-1998.
5 *  On-Line Applications Research Corporation (OAR).
6 *  Copyright assigned to U.S. Government, 1994.
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#include <rtems.h>
16#include <rtems/libio.h>
17#include <sys/stat.h>
18#include <fcntl.h>
19#include <errno.h>
20#include <unistd.h>
21
22#include "libio_.h"
23
24int chmod(
25  const char *path,
26  mode_t      mode
27)
28{
29  int                              status;
30  rtems_filesystem_location_info_t loc;
31  int                              result;
32
33  status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
34  if ( status != 0 )
35    return -1;
36 
37  if ( !loc.handlers->fchmod ){
38    rtems_filesystem_freenode( &loc );
39    set_errno_and_return_minus_one( ENOTSUP );
40  }
41
42  result = (*loc.handlers->fchmod)( &loc, mode );
43
44  rtems_filesystem_freenode( &loc );
45 
46  return result;
47}
Note: See TracBrowser for help on using the repository browser.