version 1.1.1.1.2.2, 2009/11/12 11:45:34
|
version 1.2, 2011/06/08 12:45:41
|
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 110 int main(int argc, char **argv)
|
Line 110 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); |
Timeout = strtonum(szUser, 1, 3600, &err); | Timeout = strtonum(szUser, 0, 3600, &err); |
if (!Timeout) { | 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); |
return 1; |
return 1; |
Line 149 int main(int argc, char **argv)
|
Line 149 int main(int argc, char **argv)
|
strlcpy(szMount, optarg, MAXPATHLEN); |
strlcpy(szMount, optarg, MAXPATHLEN); |
break; |
break; |
case 't': |
case 't': |
Timeout = strtonum(optarg, 1, 3600, &err); | Timeout = strtonum(optarg, 0, 3600, &err); |
if (!Timeout) { | 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); |
return 1; |
return 1; |
Line 191 int main(int argc, char **argv)
|
Line 191 int main(int argc, char **argv)
|
if ((f = mkevent(&chg, &evt)) == -1) |
if ((f = mkevent(&chg, &evt)) == -1) |
return 5; |
return 5; |
|
|
memset(&ts, 0, sizeof ts); | if (Timeout) { |
ts.tv_sec = Timeout; | memset(&ts, 0, sizeof ts); |
| ts.tv_sec = Timeout; |
| } |
switch (kevent(kq, &chg, 1, &evt, 1, !Timeout ? NULL : &ts)) { |
switch (kevent(kq, &chg, 1, &evt, 1, !Timeout ? NULL : &ts)) { |
case -1: |
case -1: |
printf("Error:: can`t execute safe mount #%d - %s\n", |
printf("Error:: can`t execute safe mount #%d - %s\n", |
Line 237 int main(int argc, char **argv)
|
Line 239 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); |