test34.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <limits.h>
#include <errno.h>
#include <ctype.h>
#include <time.h>
#include <stdio.h>

Include dependency graph for test34.c:

Go to the source code of this file.

Defines

#define MAX_ERROR   4
#define ITERATIONS   4
#define N   100
#define ALL_RWXB   (S_IRWXU | S_IRWXG | S_IRWXO)
#define ALL_SETB   (S_ISUID | S_ISGID)
#define ALL_BITS   (ALL_RWXB | ALL_SETB)
#define System(cmd)   if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
#define Chdir(dir)   if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
#define Stat(a, b)   if (stat(a,b) != 0) printf("Can't stat %s\n", a)
#define Mkfifo(f)   if (mkfifo(f,0777)!=0) printf("Can't make fifo %s\n", f)
#define Mkdir(f)   if (mkdir(f,0777)!=0) printf("Can't make dir %s\n", f)
#define Creat(f)   if (close(creat(f,0777))!=0) printf("Can't creat %s\n",f)
#define PASSWD_FILE   "/etc/passwd"

Functions

 _PROTOTYPE (void main,(int argc, char *argv[]))
 _PROTOTYPE (void test34a,(void))
 _PROTOTYPE (mode_t mode,(char *file_name))
 _PROTOTYPE (void e,(int number))
 _PROTOTYPE (void getids,(uid_t *uid, gid_t *gid))
void main (int argc, argv)
void test34a ()
void test34b ()
void test34c ()
void makelongnames ()
void e (int n)
void quit ()
void getids (uid_t *r_uid, gid_t *r_gid)

Variables

int errct = 0
int subtest = 1
int superuser
int I_can_chown
char MaxName [NAME_MAX+1]
char MaxPath [PATH_MAX]
char NameTooLong [NAME_MAX+2]
char PathTooLong [PATH_MAX+1]


Define Documentation

#define ALL_BITS   (ALL_RWXB | ALL_SETB)
 

Definition at line 28 of file test34.c.

Referenced by test34a().

#define ALL_RWXB   (S_IRWXU | S_IRWXG | S_IRWXO)
 

Definition at line 26 of file test34.c.

Referenced by test34a().

#define ALL_SETB   (S_ISUID | S_ISGID)
 

Definition at line 27 of file test34.c.

#define Chdir dir   )     if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
 

Definition at line 31 of file test34.c.

#define Creat f   )     if (close(creat(f,0777))!=0) printf("Can't creat %s\n",f)
 

Definition at line 35 of file test34.c.

#define ITERATIONS   4
 

Definition at line 23 of file test34.c.

#define MAX_ERROR   4
 

Definition at line 22 of file test34.c.

#define Mkdir f   )     if (mkdir(f,0777)!=0) printf("Can't make dir %s\n", f)
 

Definition at line 34 of file test34.c.

Referenced by dump_dir(), test34b(), test34c(), and test35c().

#define Mkfifo f   )     if (mkfifo(f,0777)!=0) printf("Can't make fifo %s\n", f)
 

Definition at line 33 of file test34.c.

#define N   100
 

Definition at line 24 of file test34.c.

#define PASSWD_FILE   "/etc/passwd"
 

Definition at line 38 of file test34.c.

Referenced by getids().

#define Stat a,
b   )     if (stat(a,b) != 0) printf("Can't stat %s\n", a)
 

Definition at line 32 of file test34.c.

#define System cmd   )     if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
 

Definition at line 30 of file test34.c.


Function Documentation

_PROTOTYPE void  getids,
(uid_t *uid, gid_t *gid
 

_PROTOTYPE void  e,
(int number) 
 

_PROTOTYPE mode_t  mode,
(char *file_name) 
 

_PROTOTYPE void  test34a,
(void) 
 

_PROTOTYPE void  main,
(int argc, char *argv[]) 
 

void e int  n  ) 
 

Definition at line 565 of file test34.c.

References chdir, errct, errno, exit(), MAX_ERROR, perror(), printf, subtest, and system().

void getids uid_t r_uid,
gid_t r_gid
 

Definition at line 603 of file test34.c.

References fclose(), fgets(), fopen(), fp, gid, i, isdigit, N, ngid, nuid, NULL, p, PASSWD_FILE, perror(), printf, strchr, and uid.

Referenced by test34c(), and test35c().

void main int  argc,
argv 
 

Definition at line 59 of file test34.c.

References atoi, chdir, exit(), fflush(), fprintf(), geteuid, i, I_can_chown, ITERATIONS, m, makelongnames(), printf, stderr, stdout, superuser, sync, System, system(), test34a(), test34b(), test34c(), and umask.

void makelongnames  ) 
 

Definition at line 544 of file test34.c.

References i, MaxName, MaxPath, memset(), and PATH_MAX.

void quit  ) 
 

Definition at line 583 of file test34.c.

References Chdir, errct, exit(), printf, System, and system().

void test34a  ) 
 

Definition at line 95 of file test34.c.

References ALL_BITS, ALL_RWXB, chmod, cnt, Creat, e, gid, mod, stat::st_atime, stat::st_ctime, stat::st_mode, stat::st_mtime, Stat, subtest, superuser, time, time_t, and uid.

Referenced by main().

void test34b  ) 
 

Definition at line 282 of file test34.c.

References chmod, Creat, e, MaxName, MaxPath, Mkdir, Mkfifo, mod, stat::st_atime, stat::st_ctime, stat::st_mode, stat::st_mtime, Stat, strlen(), subtest, superuser, time, and time_t.

Referenced by main().

void test34c  ) 
 

Definition at line 396 of file test34.c.

References alarm, chmod, chown, Creat, e, EACCES, ENAMETOOLONG, ENOENT, ENOTDIR, EPERM, errno, exit(), fork, getegid, geteuid, getids(), gid, I_can_chown, Mkdir, Mkfifo, NameTooLong, PathTooLong, printf, S_IXUSR, setgid, setuid, st, stat::st_mode, stat::st_uid, Stat, strlen(), subtest, superuser, System, system(), uid, and wait.

Referenced by main().


Variable Documentation

int errct = 0
 

Definition at line 40 of file test34.c.

int I_can_chown
 

Definition at line 43 of file test34.c.

Referenced by main(), test34c(), and test35c().

char MaxName[NAME_MAX+1]
 

Definition at line 44 of file test34.c.

char MaxPath[PATH_MAX]
 

Definition at line 45 of file test34.c.

char NameTooLong[NAME_MAX+2]
 

Definition at line 46 of file test34.c.

Referenced by test34c(), and test35c().

char PathTooLong[PATH_MAX+1]
 

Definition at line 47 of file test34.c.

Referenced by test34c(), and test35c().

int subtest = 1
 

Definition at line 41 of file test34.c.

int superuser
 

Definition at line 42 of file test34.c.


Generated on Fri Apr 14 23:22:21 2006 for minix by  doxygen 1.4.6