1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2004 Silicon Graphics, Inc.
8 * tests out if access checking is done on write path
9 * 1. opens with write perms
10 * 2. fchmod to turn off write perms
15 #include <sys/types.h>
22 main(int argc, char* argv[])
26 char *buf = "hi there\n";
31 fprintf(stderr, "%s: requires path argument\n", argv[0]);
37 printf("open for write \"%s\" with 777\n", path);
38 fd = open(path, O_RDWR, 0777);
43 printf("remove perms on file\n");
49 printf("write to the file\n");
50 x = write(fd, buf, strlen(buf));