21 if (mkdir(home,0700) == -1)
23 logmsg(
WHO,111,FATAL,B(
"unable to mkdir: ",home));
24 if (chown(home,uid,gid) == -1)
25 logmsg(
WHO,111,FATAL,B(
"unable to chown: ",home));
26 if (chmod(home,
mode) == -1)
27 logmsg(
WHO,111,FATAL,B(
"unable to chmod: ",home));
37 if (chdir(home) == -1)
38 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home));
39 if (mkdir(subdir,0700) == -1)
41 logmsg(
WHO,111,FATAL,B(
"unable to mkdir: ",home,
"/",subdir));
42 if (chown(subdir,uid,gid) == -1)
43 logmsg(
WHO,111,FATAL,B(
"unable to chown: ",home,
"/",subdir));
44 if (chmod(subdir,
mode) == -1)
45 logmsg(
WHO,111,FATAL,B(
"unable to chmod: ",home,
"/",subdir));
53void c(home,subdir,file,uid,gid,
mode)
65 logmsg(
WHO,111,FATAL,
"unable to switch back to source directory");
67 fdin = open_read(file);
69 logmsg(
WHO,111,FATAL,B(
"unable to read: ",file));
72 if (chdir(home) == -1)
73 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home));
74 if (chdir(subdir) == -1)
75 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home,
"/",subdir));
77 fdout = open_trunc(file);
79 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
84 logmsg(
WHO,111,FATAL,B(
"unable to read: ",file));
86 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
90 if (buffer_flush(&
ssout) == -1)
91 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
92 if (fsync(fdout) == -1)
93 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
94 if (close(fdout) == -1)
95 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
97 if (chown(file,uid,gid) == -1)
98 logmsg(
WHO,111,FATAL,B(
"unable to chown: .../",subdir,
"/",file));
99 if (chmod(file,
mode) == -1)
100 logmsg(
WHO,111,FATAL,B(
"unable to chmod: .../",subdir,
"/",file));
114 if (chdir(home) == -1)
115 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home));
116 if (chdir(subdir) == -1)
117 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home,
"/",subdir));
119 fdout = open_trunc(file);
121 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
125 if (buffer_put(&
ssout,
"",1) == -1)
126 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
128 if (buffer_flush(&
ssout) == -1)
129 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
130 if (fsync(fdout) == -1)
131 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
132 if (close(fdout) == -1)
133 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
135 if (chown(file,uid,gid) == -1)
136 logmsg(
WHO,111,FATAL,B(
"unable to chown: .../",subdir,
"/",file));
137 if (chmod(file,
mode) == -1)
138 logmsg(
WHO,111,FATAL,B(
"unable to chmod: .../",subdir,
"/",file));
145 logmsg(
WHO,111,FATAL,
"unable to open current directory");
void c(const char *home, const char *subdir, const char *file, int uid, int gid, int mode)
void d(const char *home, const char *subdir, int uid, int gid, int mode)
char inbuf[BUFFER_INSIZE]
void z(char *home, char *subdir, char *file, int len, int uid, int gid, int mode)
void h(char *home, int uid, int gid, int mode)
char outbuf[BUFFER_OUTSIZE]