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 /* The following function is located in chmod.c */
20 ULONG
prot_u2a(mode_t protect
);
22 /*****************************************************************************
25 #include <sys/types.h>
35 Change permission bits of a file specified by an open file descriptor.
38 filedes - File descriptor of the file
39 mode - Permission bits to set
42 0 on success and -1 on error. If an error occurred, the global
43 variable errno is set.
46 See chmod() documentation for more details about the mode parameter.
57 ******************************************************************************/
63 if (!(fdesc
= __getfdesc(filedes
)))
69 /* Get the full path of the stated filesystem object and use it to
73 if(!(buffer
= AllocVec(buffersize
, MEMF_ANY
)))
75 errno
= __stdc_ioerr2errno(IoErr());
79 if(NameFromFH(fdesc
->fcb
->handle
, buffer
, buffersize
))
81 else if(IoErr() != ERROR_LINE_TOO_LONG
)
83 errno
= __stdc_ioerr2errno(IoErr());
92 if (!SetProtection(buffer
, prot_u2a(mode
)))
95 errno
= __stdc_ioerr2errno(IoErr());