version 1.1.1.1.2.3, 2011/05/20 16:38:53
|
version 1.1.1.1.2.7, 2011/05/20 17:56:49
|
Line 18 FILE *lf;
|
Line 18 FILE *lf;
|
static inline void |
static inline void |
Log(int lvl, const char *fmt, ...) |
Log(int lvl, const char *fmt, ...) |
{ |
{ |
va_list lst; | va_list lst, cp; |
|
|
if (lvl <= Verbose) { |
if (lvl <= Verbose) { |
va_start(lst, fmt); |
va_start(lst, fmt); |
|
va_copy(cp, lst); |
vfprintf(lf, fmt, lst); |
vfprintf(lf, fmt, lst); |
fprintf(lf, "\n"); |
|
vsyslog(LOG_WARNING, fmt, lst); |
|
va_end(lst); |
va_end(lst); |
|
fprintf(lf, "\n"); |
|
vsyslog(LOG_WARNING, fmt, cp); |
|
va_end(cp); |
} |
} |
} |
} |
|
|
static inline void |
static inline void |
Err(const char *fmt, ...) |
Err(const char *fmt, ...) |
{ |
{ |
va_list lst; | va_list lst, cp; |
|
|
va_start(lst, fmt); |
va_start(lst, fmt); |
|
va_copy(cp, lst); |
vfprintf(lf, fmt, lst); |
vfprintf(lf, fmt, lst); |
fprintf(lf, "\n"); |
|
vsyslog(LOG_ERR, fmt, lst); |
|
va_end(lst); |
va_end(lst); |
|
fprintf(lf, "\n"); |
|
vsyslog(LOG_ERR, fmt, cp); |
|
va_end(cp); |
} |
} |
|
|
static void |
static void |
Line 49 initProg()
|
Line 53 initProg()
|
proc.proc_prio = getpriority(PRIO_PROCESS, 0); |
proc.proc_prio = getpriority(PRIO_PROCESS, 0); |
getcwd(proc.proc_dir, sizeof proc.proc_dir); |
getcwd(proc.proc_dir, sizeof proc.proc_dir); |
|
|
|
#if 0 |
lf = fopen(DEFAULT_LOG, "a"); |
lf = fopen(DEFAULT_LOG, "a"); |
if (!lf) |
if (!lf) |
|
#endif |
lf = stdout; |
lf = stdout; |
|
|
openlog(PACKAGE_NAME, LOG_CONS | LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_USER); | openlog(PACKAGE_NAME, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER); |
} |
} |
|
|
static void |
static void |
Line 222 Run(char **argv)
|
Line 228 Run(char **argv)
|
return -1; |
return -1; |
} |
} |
|
|
|
/* |
if (setgid(proc.proc_gid) == -1) { |
if (setgid(proc.proc_gid) == -1) { |
Err("Error:: setgid #%d - %s\n", errno, strerror(errno)); |
Err("Error:: setgid #%d - %s\n", errno, strerror(errno)); |
if (args) |
if (args) |
Line 240 Run(char **argv)
|
Line 247 Run(char **argv)
|
free(args); |
free(args); |
return -1; |
return -1; |
} |
} |
|
*/ |
|
|
Log(1, "UID:GID=%d:%d Prio=%d Class=%s Name=%s Dir=%s Cmd=%s\n", proc.proc_uid, proc.proc_gid, | Log(0, "UID:GID=%d:%d Prio=%d Class=%s Name=%s Dir=%s Cmd=%s", proc.proc_uid, proc.proc_gid, |
proc.proc_prio, proc.proc_class, proc.proc_name, proc.proc_dir, proc.proc_cmd); |
proc.proc_prio, proc.proc_class, proc.proc_name, proc.proc_dir, proc.proc_cmd); |
|
|
if (3 <= Verbose) { |
if (3 <= Verbose) { |
Line 249 Run(char **argv)
|
Line 257 Run(char **argv)
|
while (*++el) |
while (*++el) |
Log(3, "args: %s", *el); |
Log(3, "args: %s", *el); |
} |
} |
|
|
|
fflush(lf); |
|
|
execve(cmd, args, environ); |
execve(cmd, args, environ); |
if (args) |
if (args) |