File: 013_test_chmod.c

package info (click to toggle)
cowdancer 0.90
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 648 kB
  • sloc: ansic: 4,593; sh: 407; makefile: 142; cpp: 5
file content (26 lines) | stat: -rw-r--r-- 430 bytes parent folder | download | duplicates (5)
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
/*
 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;
}