2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 POSIX.1-2008 function fchmod().
10 #include <aros/debug.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
13 #include <sys/types.h>
19 ULONG
prot_u2a(mode_t protect
);
21 /*****************************************************************************
24 #include <sys/types.h>
34 Change permission bits of a file specified by an open file descriptor.
37 filedes - File descriptor of the file
38 mode - Permission bits to set
41 0 on success and -1 on error. If an error occurred, the global
42 variable errno is set.
45 See chmod() documentation for more details about the mode parameter.
56 ******************************************************************************/
62 if (!(fdesc
= __getfdesc(filedes
)))
68 /* Get the full path of the stated filesystem object and use it to
72 if(!(buffer
= AllocVec(buffersize
, MEMF_ANY
)))
74 errno
= __arosc_ioerr2errno(IoErr());
78 if(NameFromFH(fdesc
->fcb
->fh
, buffer
, buffersize
))
80 else if(IoErr() != ERROR_LINE_TOO_LONG
)
82 errno
= __arosc_ioerr2errno(IoErr());
91 if (!SetProtection(buffer
, prot_u2a(mode
)))
94 errno
= __arosc_ioerr2errno(IoErr());