diff options
author | Vinayak Hegde <vinayak@gluster.com> | 2009-11-26 01:46:24 -0800 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2009-12-01 19:10:18 +0530 |
commit | a128d1b9ad23b6c1b855401844cf133a492e0bca (patch) | |
tree | 4927e5931c4add55a5f76ba199f498a5894970e6 /143/regr/ctestfun.c | |
parent | 407beff649bae9e61b2994167699f0c737884aad (diff) |
Regression test case for bug 143.
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to '143/regr/ctestfun.c')
-rw-r--r-- | 143/regr/ctestfun.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/143/regr/ctestfun.c b/143/regr/ctestfun.c new file mode 100644 index 0000000..4184a21 --- /dev/null +++ b/143/regr/ctestfun.c @@ -0,0 +1,38 @@ +#include <unistd.h> +#include <sys/types.h> +#include <fcntl.h> +#include <malloc.h> +#include <sys/stat.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> + +int main (int argc,char *argv[]) { + char *n0 = NULL; + struct stat *buf1 = NULL; + int ret = 0; + + n0 = argv[1]; + buf1 = calloc (1, sizeof (*buf1)); + gid_t list[3] = {65533, 65532, 65531}; + + creat (n0, 0644); + chown (n0, 65534, 65533); + chmod (n0, 06555); + + setgroups (3, &list); + setuid (65534); + + chown (n0, 65534, 65532); + ret = stat (n0, buf1); + if (ret == -1) { + printf ("stat error, error no = %d",errno); + exit (EXIT_FAILURE); + } + if (buf1->st_gid != 65532) + exit (EXIT_FAILURE); + + free (buf1); + + exit (EXIT_SUCCESS); +} |