17 if (mkdir(
home,0700) == -1)
19 logmsg(
WHO,111,FATAL,B(
"unable to mkdir: ",
home));
21 logmsg(
WHO,111,FATAL,B(
"unable to chown: ",
home));
22 if (chmod(
home,mode) == -1)
23 logmsg(
WHO,111,FATAL,B(
"unable to chmod: ",
home));
26void d(
char *
home,
char *subdir,
int uid,
int gid,
int mode)
28 if (chdir(
home) == -1)
29 logmsg(
WHO,110,FATAL,B(
"unable to switch to: ",
home));
30 if (mkdir(subdir,0700) == -1)
32 logmsg(
WHO,111,FATAL,B(
"unable to mkdir: ",
home,
"/",subdir));
33 if (chown(subdir,
uid,gid) == -1)
34 logmsg(
WHO,111,FATAL,B(
"unable to chown: ",
home,
"/",subdir));
35 if (chmod(subdir,mode) == -1)
36 logmsg(
WHO,111,FATAL,B(
"unable to chmod: ",
home,
"/",subdir));
39void p(
char *
home,
char *fifo,
int uid,
int gid,
int mode)
41 if (chdir(
home) == -1)
42 logmsg(
WHO,110,FATAL,B(
"unable to switch to: ",
home));
45 logmsg(
WHO,111,FATAL,B(
"unable to mkfifo: ",
home,
"/",fifo));
46 if (chown(fifo,
uid,gid) == -1)
47 logmsg(
WHO,111,FATAL,B(
"unable to chown: ",
home,
"/",fifo));
48 if (chmod(fifo,mode) == -1)
49 logmsg(
WHO,111,FATAL,B(
"unable to chmod: ",
home,
"/",fifo));
63 logmsg(
WHO,110,FATAL,
"unable to switch back to source directory: ");
67 logmsg(
WHO,111,FATAL,B(
"unable to read: ",
file));
70 if (chdir(
home) == -1)
71 logmsg(
WHO,110,FATAL,B(
"unable to switch to: ",
home));
72 if (chdir(subdir) == -1)
73 logmsg(
WHO,110,FATAL,B(
"unable to switch to: ",
home,
"/",subdir));
77 logmsg(
WHO,111,FATAL,B(
"unable to write .../",subdir,
"/",
file));
80 switch (buffer_copy(&
bo,&
bi)) {
82 logmsg(
WHO,111,FATAL,B(
"unable to read: ",
file));
84 logmsg(
WHO,111,FATAL,B(
"unable to write .../",subdir,
"/",
file));
88 if (buffer_flush(&
bo) == -1)
89 logmsg(
WHO,111,FATAL,B(
"unable to write .../",subdir,
"/",
file));
90 if (fsync(
fdout) == -1)
91 logmsg(
WHO,111,FATAL,B(
"unable to write .../",subdir,
"/",
file));
92 if (close(
fdout) == -1)
93 logmsg(
WHO,111,FATAL,B(
"unable to write .../",subdir,
"/",
file));
96 logmsg(
WHO,111,FATAL,B(
"unable to chown .../",subdir,
"/",
file));
97 if (chmod(
file,mode) == -1)
98 logmsg(
WHO,111,FATAL,B(
"unable to chmod .../",subdir,
"/",
file));
105 if (chdir(
home) == -1)
106 logmsg(
WHO,110,FATAL,B(
"unable to switch to: ",
home));
110 logmsg(
WHO,111,FATAL,B(
"unable to write: ",
home,
"/",
file));
114 if (buffer_put(&
bo,
"",1) == -1)
115 logmsg(
WHO,111,FATAL,B(
"unable to write: ",
home,
"/",
file));
117 if (buffer_flush(&
bo) == -1)
118 logmsg(
WHO,111,FATAL,B(
"unable to write: ",
home,
"/",
file));
119 if (fsync(
fdout) == -1)
120 logmsg(
WHO,111,FATAL,B(
"unable to write: ",
home,
"/",
file));
121 if (close(
fdout) == -1)
122 logmsg(
WHO,111,FATAL,B(
"unable to write: ",
home,
"/",
file));
125 logmsg(
WHO,111,FATAL,B(
"unable to chown: ",
home,
"/",
file));
126 if (chmod(
file,mode) == -1)
127 logmsg(
WHO,111,FATAL,B(
"unable to chmod: ",
home,
"/",
file));
134 logmsg(
WHO,110,FATAL,
"unable to open current directory: ");
int fifo_make(char *fn, int mode)
void c(char *, char *, char *, int, int, int)
void p(char *home, char *fifo, int uid, int gid, int mode)
char inbuf[BUFFER_INSIZE]
void h(char *home, int uid, int gid, int mode)
void z(char *home, char *file, int len, int uid, int gid, int mode)
char outbuf[BUFFER_OUTSIZE]