version 1.1.1.1.2.3, 2009/11/12 11:51:50
|
version 1.2.2.1, 2011/06/13 20:04:12
|
Line 25 static void Usage()
|
Line 25 static void Usage()
|
"\t-v\t\tVerbose ...\n" |
"\t-v\t\tVerbose ...\n" |
"\t-c <dir>\tAfter execute chroot to dir [default=/]\n" |
"\t-c <dir>\tAfter execute chroot to dir [default=/]\n" |
"\t-u <user>\tAfter execute suid to user [default=root]\n" |
"\t-u <user>\tAfter execute suid to user [default=root]\n" |
"\t-d <dev>\tOther device [default=/dev/ufs/AITBSDonCF]\n" | "\t-d <dev>\tOther device [default=/dev/ufs/elwix]\n" |
"\t-m <mnt>\tOther mount dir [default=/cf]\n" |
"\t-m <mnt>\tOther mount dir [default=/cf]\n" |
"\t-t <sec>\tTimeout for autolock mount dir after seconds [default=300]\n" |
"\t-t <sec>\tTimeout for autolock mount dir after seconds [default=300]\n" |
"\n", compiled, compiledby, compilehost); |
"\n", compiled, compiledby, compilehost); |
Line 37 static int update(int flags)
|
Line 37 static int update(int flags)
|
|
|
memset(&mnt, 0, sizeof mnt); |
memset(&mnt, 0, sizeof mnt); |
mnt.fspec = szDev; |
mnt.fspec = szDev; |
|
#ifdef __NetBSD__ |
|
if (mount("ufs", szMount, flags, &mnt, sizeof mnt) == -1) { |
|
#else |
if (mount("ufs", szMount, flags, &mnt) == -1) { |
if (mount("ufs", szMount, flags, &mnt) == -1) { |
|
#endif |
printf("Error:: can`t update mount %s #%d - %s\n", szMount, errno, strerror(errno)); |
printf("Error:: can`t update mount %s #%d - %s\n", szMount, errno, strerror(errno)); |
return -1; |
return -1; |
} |
} |
Line 88 static int mkevent(struct kevent *chg, struct kevent *
|
Line 92 static int mkevent(struct kevent *chg, struct kevent *
|
memset(chg, 0, sizeof(struct kevent)); |
memset(chg, 0, sizeof(struct kevent)); |
memset(evt, 0, sizeof(struct kevent)); |
memset(evt, 0, sizeof(struct kevent)); |
|
|
EV_SET(chg, f, EVFILT_VNODE, EV_ADD, NOTE_DELETE | NOTE_RENAME | NOTE_REVOKE, 0, NULL); | EV_SET(chg, f, EVFILT_VNODE, EV_ADD, NOTE_DELETE | NOTE_RENAME | NOTE_REVOKE, 0, (intptr_t) NULL); |
} |
} |
|
|
return f; |
return f; |
Line 99 static int mkevent(struct kevent *chg, struct kevent *
|
Line 103 static int mkevent(struct kevent *chg, struct kevent *
|
int main(int argc, char **argv) |
int main(int argc, char **argv) |
{ |
{ |
char ch; |
char ch; |
const char *err; | const char *err = NULL; |
struct kevent chg, evt; |
struct kevent chg, evt; |
struct timespec ts; |
struct timespec ts; |
pid_t pid; |
pid_t pid; |
Line 110 int main(int argc, char **argv)
|
Line 114 int main(int argc, char **argv)
|
// Load variables from config if exists |
// Load variables from config if exists |
if (!LoadConfig(szConfig, &cfg)) { |
if (!LoadConfig(szConfig, &cfg)) { |
cfg_LoadAttribute(&cfg, CFG("cfexec"), CFG("timeout"), CFG(szUser), MAX_STR, DEFAULT_TIMEOUT); |
cfg_LoadAttribute(&cfg, CFG("cfexec"), CFG("timeout"), CFG(szUser), MAX_STR, DEFAULT_TIMEOUT); |
|
#ifndef HAVE_STRTONUM |
|
Timeout = (int) strtol(szUser, NULL, 0); |
|
#else |
Timeout = strtonum(szUser, 0, 3600, &err); |
Timeout = strtonum(szUser, 0, 3600, &err); |
|
#endif |
if (!Timeout && err) { |
if (!Timeout && err) { |
printf("Error:: in seconds for timeout %s - %s\n", optarg, err); |
printf("Error:: in seconds for timeout %s - %s\n", optarg, err); |
UnloadConfig(&cfg); |
UnloadConfig(&cfg); |
Line 149 int main(int argc, char **argv)
|
Line 157 int main(int argc, char **argv)
|
strlcpy(szMount, optarg, MAXPATHLEN); |
strlcpy(szMount, optarg, MAXPATHLEN); |
break; |
break; |
case 't': |
case 't': |
|
#ifndef HAVE_STRTONUM |
|
Timeout = (int) strtol(szUser, NULL, 0); |
|
#else |
Timeout = strtonum(optarg, 0, 3600, &err); |
Timeout = strtonum(optarg, 0, 3600, &err); |
|
#endif |
if (!Timeout && err) { |
if (!Timeout && err) { |
printf("Error:: in seconds for timeout %s - %s\n", |
printf("Error:: in seconds for timeout %s - %s\n", |
optarg, err); |
optarg, err); |
Line 239 int main(int argc, char **argv)
|
Line 251 int main(int argc, char **argv)
|
if (strncmp(szUser, "root", 5)) |
if (strncmp(szUser, "root", 5)) |
setuser(); |
setuser(); |
|
|
chdir("/"); | /* chdir("/"); */ |
execvp(*argv, argv); |
execvp(*argv, argv); |
} |
} |
_exit(127); |
_exit(127); |