2
* Copyright (C) 2002-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
13
#include <sys/types.h>
18
int main(int argc, char *argv[])
24
fprintf(stderr, "usage: %s file groupname|gid\n",
30
if (sscanf(argv[2], "%d", &gid) != 1) {
31
fprintf(stderr, "FAIL: bad gid %s\n", argv[2]);
35
fd = open(argv[1], O_RDONLY);
37
fprintf(stderr, "FAIL: open %s failed - %s\n",
38
argv[1], strerror(errno));
43
if (fchown(fd, -1, gid) == -1) {
44
fprintf(stderr, "FAIL: fchgrp %s %d failed - %s\n",
45
argv[1], gid, strerror(errno));