예제 #1
0
/*
 *  chown()/lchown() multiple files at a time
 */
void chown_multiple_files_helper(
  char **files,
  int    follow_link
)
{
  int    i;
  uid_t  st_uid;
  gid_t  st_gid;

  st_uid = geteuid();
  st_gid = getegid();

  i = 0;
  while ( files[i] ) {
    printf("Change group of %s\n", files[i]);
    if ( follow_link ) {
      chown( files[i], st_uid, (st_gid+1) );
      stat_a_file( files[i] );
    } else {
      lchown( files[i], st_uid, (st_gid+1) );
      lstat_a_file( files[i] );
    }

    printf("Change owner of %s\n", files[i]);
    if ( follow_link ) {
      chown( files[i], (st_uid+1), st_gid );
      stat_a_file( files[i] );
    } else {
      lchown( files[i], (st_uid+1), st_gid );
      lstat_a_file( files[i] );
    }
    i++;
  }

}
예제 #2
0
void stat_multiple_files(
  char **files
)
{
  int    i;

  i = 0;
  while ( files[i] ) {
    stat_a_file( files[i] );
    i++;
  }
}
예제 #3
0
/*
 *  chown() multiple files at a time
 */
void chown_multiple_files(
  char **files
)
{
  int    i;
  uid_t  st_uid;
  gid_t  st_gid;

  st_uid = geteuid();
  st_gid = getegid();

  i = 0;
  while ( files[i] ) {
    printf("Change group of %s\n", files[i]);
    chown( files[i], st_uid, (st_gid+1) );
    stat_a_file( files[i] );

    printf("Change owner of %s\n", files[i]);
    chown( files[i], (st_uid+1), st_gid );
    stat_a_file( files[i] );
    i++;
  }

}