only update affected area of bitmap
[AROS.git] / test / clib / chmod.c
blobb14681fa02cc880a2e0cb1a6f58856cee87b8f40
1 #include <sys/stat.h>
2 #include <sys/types.h>
3 #include <unistd.h>
4 #include <fcntl.h>
5 #include <stdio.h>
6 #include "test.h"
8 char testfilename[] = "RAM:__TEST__";
10 int main()
12 struct stat buf;
13 int fd;
14 fd = creat(testfilename, 0700);
15 TEST((fd != -1));
16 close(fd);
17 TEST((stat(testfilename, &buf) != -1));
18 TEST(((buf.st_mode & 0777) == 0700));
19 TEST((chmod(testfilename, 0111) != -1));
20 TEST((stat(testfilename, &buf) != -1));
21 TEST(((buf.st_mode & 0777) == 0111));
22 TEST((chmod(testfilename, 0222) != -1));
23 TEST((stat(testfilename, &buf) != -1));
24 TEST(((buf.st_mode & 0777) == 0222));
25 TEST((chmod(testfilename, 0333) != -1));
26 TEST((stat(testfilename, &buf) != -1));
27 TEST(((buf.st_mode & 0777) == 0333));
28 TEST((chmod(testfilename, 0444) != -1));
29 TEST((stat(testfilename, &buf) != -1));
30 TEST(((buf.st_mode & 0777) == 0444));
31 TEST((chmod(testfilename, 0555) != -1));
32 TEST((stat(testfilename, &buf) != -1));
33 TEST(((buf.st_mode & 0777) == 0555));
34 TEST((chmod(testfilename, 0666) != -1));
35 TEST((stat(testfilename, &buf) != -1));
36 TEST(((buf.st_mode & 0777) == 0666));
37 TEST((chmod(testfilename, 0777) != -1));
38 TEST((stat(testfilename, &buf) != -1));
39 TEST(((buf.st_mode & 0777) == 0777));
40 cleanup();
41 return OK;
44 void cleanup()
46 remove(testfilename);