- Set a default PCM volume so that something can be heard when driver is
[AROS.git] / test / clib / fchmod.c
blob3fe377315977c39db2236825ba0ff716c4b7644f
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[] = "__TEST__";
9 int fd;
11 int main()
13 struct stat buf;
14 fd = creat(testfilename, 0700);
15 TEST((fd != -1));
16 TEST((fchmod(fd, 0444) != -1));
17 TEST((fstat(fd, &buf) != -1));
18 TEST(((buf.st_mode & 0777) == 0444));
19 TEST((fchmod(fd, 0555) != -1));
20 TEST((fstat(fd, &buf) != -1));
21 TEST(((buf.st_mode & 0777) == 0555));
22 TEST((fchmod(fd, 0666) != -1));
23 TEST((fstat(fd, &buf) != -1));
24 TEST(((buf.st_mode & 0777) == 0666));
25 TEST((fchmod(fd, 0777) != -1));
26 TEST((fstat(fd, &buf) != -1));
27 TEST(((buf.st_mode & 0777) == 0777));
28 close(fd);
29 cleanup();
30 return OK;
33 void cleanup()
35 close(fd);
36 remove(testfilename);