Logo Search packages:      
Sourcecode: cowdancer version File versions  Download package


chown test
Used by 012 and 020 tests.

/* for fchown */
/*#define _BSD_SOURCE*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
//#include <sys/types.h>
//#include <sys/stat.h>
//#include <fcntl.h>

int main(int argc, char** argv)
  uid_t uid=getuid();
  gid_t gid;
  //int fid;
  /* test that four args are given. */
  if(argc < 5)
  gid=atoi(argv[1]);          /* get the gid to change to */
  printf("chown %s\n", argv[2]);
  chown(argv[2], uid, gid);
  //fid=open(argv[3], O_RDONLY);
  //if (fchown(fid, uid, gid)!=-1)  /* this func will fail */
  //  return 1;

  printf("lchown %s\n", argv[4]);
  lchown(argv[4], uid, gid);

  return 0;

Generated by  Doxygen 1.6.0   Back to index