File: 013_test_chmod.c

package info (click to toggle)
cowdancer 0.73
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 752 kB
  • ctags: 269
  • sloc: ansic: 3,822; sh: 481; makefile: 191; cpp: 6
file content (26 lines) | stat: -rwxr-xr-x 446 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*BINFMTC:
 chmod test */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>

/* chmod to 0400 */
int main(int argc, char** argv)
{
  int fid;
  
  /* test that the two args work. */
  if(argc < 3)
    exit(1);
  
  chmod(argv[1], 0400);
  fid=open(argv[2], O_RDONLY);
  //if (fchmod(fid, 0400)!=-1)
  //  return 1;			/* this func will fail */
  close(fid);
	
  return 0;
}