9static const char *fatal;
10static const char *
dir;
17void init(
const char *d,
const char *f)
22 if (mkdir(
dir,0700) == -1)
23 logmsg(fatal,111,FATAL,B(
"unable to create: ",
dir));
24 if (chmod(
dir,03755) == -1)
25 logmsg(fatal,111,FATAL,B(
"unable to set mode of: ",
dir));
27 logmsg(fatal,111,FATAL,B(
"unable to switch to: ",
dir));
32 logmsg(fatal,111,FATAL,B(
"unable to create: ",
dir,
"/",
fn));
38 if (mkdir(
fn,0700) == -1)
fail();
46 buffer_init(&ss,buffer_unixwrite,
fd,
buf,
sizeof(
buf));
51 if (buffer_puts(&ss,s) == -1)
fail();
54void out(
const char *s,
unsigned int len)
56 if (buffer_put(&ss,s,
len) == -1)
fail();
61 if (buffer_copy(&ss,
b) < 0)
fail();
66 if (buffer_flush(&ss) == -1)
fail();
67 if (fsync(
fd) == -1)
fail();
78 if (chown(
fn,uid,gid) == -1)
fail();
94 outs(
"#!/bin/sh\nexec");
96 outs(
" multilog t ./main\n");
void owner(int uid, int gid)
void init(const char *d, const char *f)
void start(const char *s)
void makedir(const char *s)
void out(const char *s, unsigned int len)
void makelog(const char *user, int uid, int gid)
void d(const char *home, const char *subdir, int uid, int gid, int mode)