Add sun4i ram controller definitions
[AROS.git] / test / clib / fchmod.c
blobc7f4c3cde1fa2d5db17e20bceeca1d62f1de3f60
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <sys/stat.h>
7 #include <sys/types.h>
8 #include <unistd.h>
9 #include <fcntl.h>
10 #include <stdio.h>
11 #include "test.h"
13 char testfilename[] = "__TEST__";
14 int fd;
16 int main()
18 struct stat buf;
19 fd = creat(testfilename, 0700);
20 TEST((fd != -1));
21 TEST((fchmod(fd, 0444) != -1));
22 TEST((fstat(fd, &buf) != -1));
23 TEST(((buf.st_mode & 0777) == 0444));
24 TEST((fchmod(fd, 0555) != -1));
25 TEST((fstat(fd, &buf) != -1));
26 TEST(((buf.st_mode & 0777) == 0555));
27 TEST((fchmod(fd, 0666) != -1));
28 TEST((fstat(fd, &buf) != -1));
29 TEST(((buf.st_mode & 0777) == 0666));
30 TEST((fchmod(fd, 0777) != -1));
31 TEST((fstat(fd, &buf) != -1));
32 TEST(((buf.st_mode & 0777) == 0777));
33 close(fd);
34 cleanup();
35 return OK;
38 void cleanup()
40 close(fd);
41 remove(testfilename);