2
* Copyright (C) 2007 Novell/SUSE
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation, version 2 of the
11
#include <sys/types.h>
17
int main(int argc, char *argv[])
23
fprintf(stderr, "usage: %s file mode\n", argv[0]);
27
if (sscanf(argv[2], "%o", &mode) != 1) {
28
fprintf(stderr, "FAIL: bad mode %s\n", argv[2]);
32
fd = open(argv[1], O_RDONLY);
34
fprintf(stderr, "FAIL: open %s failed - %s\n",
35
argv[1], strerror(errno));
40
if (fchmod(fd, mode) == -1) {
41
fprintf(stderr, "FAIL: fchmod %s %o failed - %s\n",
42
argv[1], mode, strerror(errno));