diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-07-28 09:37:56 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-07-28 09:37:56 +0000 |
commit | 9b4766116579e1b614b537d72730b7e7f5d7e66c (patch) | |
tree | d8153085ee689bb7f61adfbb846c25f26ceba2d1 /miscutils/crond.c | |
parent | 68d4a85f129f029ff7c42a65ca723444384f7357 (diff) | |
download | busybox-w32-9b4766116579e1b614b537d72730b7e7f5d7e66c.tar.gz busybox-w32-9b4766116579e1b614b537d72730b7e7f5d7e66c.tar.bz2 busybox-w32-9b4766116579e1b614b537d72730b7e7f5d7e66c.zip |
Avoid shadowing built-in function `log'
Diffstat (limited to 'miscutils/crond.c')
-rw-r--r-- | miscutils/crond.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c index b13959368..f0920136f 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c | |||
@@ -114,7 +114,7 @@ static CronFile *FileBase; | |||
114 | 114 | ||
115 | 115 | ||
116 | static void | 116 | static void |
117 | log(const char *ctl, ...) | 117 | crondlog(const char *ctl, ...) |
118 | { | 118 | { |
119 | va_list va; | 119 | va_list va; |
120 | int level = (int)(ctl[0] & 0xf); | 120 | int level = (int)(ctl[0] & 0xf); |
@@ -219,7 +219,7 @@ crond_main(int ac, char **av) | |||
219 | * of 1 second. | 219 | * of 1 second. |
220 | */ | 220 | */ |
221 | 221 | ||
222 | log("\011%s " VERSION " dillon, started, log level %d\n", bb_applet_name, | 222 | crondlog("\011%s " VERSION " dillon, started, log level %d\n", bb_applet_name, |
223 | LogLevel); | 223 | LogLevel); |
224 | 224 | ||
225 | SynchronizeDir(); | 225 | SynchronizeDir(); |
@@ -261,11 +261,11 @@ crond_main(int ac, char **av) | |||
261 | CheckUpdates(); | 261 | CheckUpdates(); |
262 | #ifdef FEATURE_DEBUG_OPT | 262 | #ifdef FEATURE_DEBUG_OPT |
263 | if (DebugOpt) | 263 | if (DebugOpt) |
264 | log("\005Wakeup dt=%d\n", dt); | 264 | crondlog("\005Wakeup dt=%d\n", dt); |
265 | #endif | 265 | #endif |
266 | if (dt < -60*60 || dt > 60*60) { | 266 | if (dt < -60*60 || dt > 60*60) { |
267 | t1 = t2; | 267 | t1 = t2; |
268 | log("\111time disparity of %d minutes detected\n", dt / 60); | 268 | crondlog("\111time disparity of %d minutes detected\n", dt / 60); |
269 | } else if (dt > 0) { | 269 | } else if (dt > 0) { |
270 | TestJobs(t1, t2); | 270 | TestJobs(t1, t2); |
271 | RunJobs(); | 271 | RunJobs(); |
@@ -308,7 +308,7 @@ ChangeUser(const char *user) | |||
308 | */ | 308 | */ |
309 | 309 | ||
310 | if ((pas = getpwnam(user)) == 0) { | 310 | if ((pas = getpwnam(user)) == 0) { |
311 | log("\011failed to get uid for %s", user); | 311 | crondlog("\011failed to get uid for %s", user); |
312 | return(-1); | 312 | return(-1); |
313 | } | 313 | } |
314 | setenv("USER", pas->pw_name, 1); | 314 | setenv("USER", pas->pw_name, 1); |
@@ -320,22 +320,22 @@ ChangeUser(const char *user) | |||
320 | */ | 320 | */ |
321 | 321 | ||
322 | if (initgroups(user, pas->pw_gid) < 0) { | 322 | if (initgroups(user, pas->pw_gid) < 0) { |
323 | log("\011initgroups failed: %s %m", user); | 323 | crondlog("\011initgroups failed: %s %m", user); |
324 | return(-1); | 324 | return(-1); |
325 | } | 325 | } |
326 | /* drop all priviledges */ | 326 | /* drop all priviledges */ |
327 | if (setgid(pas->pw_gid) < 0) { | 327 | if (setgid(pas->pw_gid) < 0) { |
328 | log("\011setgid failed: %s %d", user, pas->pw_gid); | 328 | crondlog("\011setgid failed: %s %d", user, pas->pw_gid); |
329 | return(-1); | 329 | return(-1); |
330 | } | 330 | } |
331 | if (setuid(pas->pw_uid) < 0) { | 331 | if (setuid(pas->pw_uid) < 0) { |
332 | log("\011setuid failed: %s %d", user, pas->pw_uid); | 332 | crondlog("\011setuid failed: %s %d", user, pas->pw_uid); |
333 | return(-1); | 333 | return(-1); |
334 | } | 334 | } |
335 | if (chdir(pas->pw_dir) < 0) { | 335 | if (chdir(pas->pw_dir) < 0) { |
336 | log("\011chdir failed: %s: %m", pas->pw_dir); | 336 | crondlog("\011chdir failed: %s: %m", pas->pw_dir); |
337 | if (chdir(TMPDIR) < 0) { | 337 | if (chdir(TMPDIR) < 0) { |
338 | log("\011chdir failed: %s: %m", TMPDIR); | 338 | crondlog("\011chdir failed: %s: %m", TMPDIR); |
339 | return(-1); | 339 | return(-1); |
340 | } | 340 | } |
341 | } | 341 | } |
@@ -460,7 +460,7 @@ ParseField(char *user, char *ary, int modvalue, int off, | |||
460 | */ | 460 | */ |
461 | 461 | ||
462 | if (skip == 0) { | 462 | if (skip == 0) { |
463 | log("\111failed user %s parsing %s\n", user, base); | 463 | crondlog("\111failed user %s parsing %s\n", user, base); |
464 | return(NULL); | 464 | return(NULL); |
465 | } | 465 | } |
466 | if (*ptr == '-' && n2 < 0) { | 466 | if (*ptr == '-' && n2 < 0) { |
@@ -499,7 +499,7 @@ ParseField(char *user, char *ary, int modvalue, int off, | |||
499 | } while (n1 != n2 && --failsafe); | 499 | } while (n1 != n2 && --failsafe); |
500 | 500 | ||
501 | if (failsafe == 0) { | 501 | if (failsafe == 0) { |
502 | log("\111failed user %s parsing %s\n", user, base); | 502 | crondlog("\111failed user %s parsing %s\n", user, base); |
503 | return(NULL); | 503 | return(NULL); |
504 | } | 504 | } |
505 | } | 505 | } |
@@ -511,7 +511,7 @@ ParseField(char *user, char *ary, int modvalue, int off, | |||
511 | } | 511 | } |
512 | 512 | ||
513 | if (*ptr != ' ' && *ptr != '\t' && *ptr != '\n') { | 513 | if (*ptr != ' ' && *ptr != '\t' && *ptr != '\n') { |
514 | log("\111failed user %s parsing %s\n", user, base); | 514 | crondlog("\111failed user %s parsing %s\n", user, base); |
515 | return(NULL); | 515 | return(NULL); |
516 | } | 516 | } |
517 | 517 | ||
@@ -523,8 +523,8 @@ ParseField(char *user, char *ary, int modvalue, int off, | |||
523 | int i; | 523 | int i; |
524 | 524 | ||
525 | for (i = 0; i < modvalue; ++i) | 525 | for (i = 0; i < modvalue; ++i) |
526 | log("\005%d", ary[i]); | 526 | crondlog("\005%d", ary[i]); |
527 | log("\005\n"); | 527 | crondlog("\005\n"); |
528 | } | 528 | } |
529 | #endif | 529 | #endif |
530 | 530 | ||
@@ -603,7 +603,7 @@ SynchronizeFile(const char *fileName) | |||
603 | 603 | ||
604 | #ifdef FEATURE_DEBUG_OPT | 604 | #ifdef FEATURE_DEBUG_OPT |
605 | if (DebugOpt) | 605 | if (DebugOpt) |
606 | log("\111User %s Entry %s\n", fileName, buf); | 606 | crondlog("\111User %s Entry %s\n", fileName, buf); |
607 | #endif | 607 | #endif |
608 | 608 | ||
609 | /* | 609 | /* |
@@ -641,7 +641,7 @@ SynchronizeFile(const char *fileName) | |||
641 | 641 | ||
642 | #ifdef FEATURE_DEBUG_OPT | 642 | #ifdef FEATURE_DEBUG_OPT |
643 | if (DebugOpt) { | 643 | if (DebugOpt) { |
644 | log("\111 Command %s\n", ptr); | 644 | crondlog("\111 Command %s\n", ptr); |
645 | } | 645 | } |
646 | #endif | 646 | #endif |
647 | 647 | ||
@@ -653,7 +653,7 @@ SynchronizeFile(const char *fileName) | |||
653 | FileBase = file; | 653 | FileBase = file; |
654 | 654 | ||
655 | if (maxLines == 0 || maxEntries == 0) | 655 | if (maxLines == 0 || maxEntries == 0) |
656 | log("\111Maximum number of lines reached for user %s\n", fileName); | 656 | crondlog("\111Maximum number of lines reached for user %s\n", fileName); |
657 | } | 657 | } |
658 | fclose(fi); | 658 | fclose(fi); |
659 | } | 659 | } |
@@ -703,7 +703,7 @@ SynchronizeDir(void) | |||
703 | 703 | ||
704 | remove(CRONUPDATE); | 704 | remove(CRONUPDATE); |
705 | if (chdir(CDir) < 0) { | 705 | if (chdir(CDir) < 0) { |
706 | log("\311unable to find %s\n", CDir); | 706 | crondlog("\311unable to find %s\n", CDir); |
707 | } | 707 | } |
708 | { | 708 | { |
709 | DIR *dir; | 709 | DIR *dir; |
@@ -716,11 +716,11 @@ SynchronizeDir(void) | |||
716 | if (getpwnam(den->d_name)) | 716 | if (getpwnam(den->d_name)) |
717 | SynchronizeFile(den->d_name); | 717 | SynchronizeFile(den->d_name); |
718 | else | 718 | else |
719 | log("\007ignoring %s\n", den->d_name); | 719 | crondlog("\007ignoring %s\n", den->d_name); |
720 | } | 720 | } |
721 | closedir(dir); | 721 | closedir(dir); |
722 | } else { | 722 | } else { |
723 | log("\311Unable to open current dir!\n"); | 723 | crondlog("\311Unable to open current dir!\n"); |
724 | } | 724 | } |
725 | } | 725 | } |
726 | } | 726 | } |
@@ -797,14 +797,14 @@ TestJobs(time_t t1, time_t t2) | |||
797 | for (file = FileBase; file; file = file->cf_Next) { | 797 | for (file = FileBase; file; file = file->cf_Next) { |
798 | #ifdef FEATURE_DEBUG_OPT | 798 | #ifdef FEATURE_DEBUG_OPT |
799 | if (DebugOpt) | 799 | if (DebugOpt) |
800 | log("\005FILE %s:\n", file->cf_User); | 800 | crondlog("\005FILE %s:\n", file->cf_User); |
801 | #endif | 801 | #endif |
802 | if (file->cf_Deleted) | 802 | if (file->cf_Deleted) |
803 | continue; | 803 | continue; |
804 | for (line = file->cf_LineBase; line; line = line->cl_Next) { | 804 | for (line = file->cf_LineBase; line; line = line->cl_Next) { |
805 | #ifdef FEATURE_DEBUG_OPT | 805 | #ifdef FEATURE_DEBUG_OPT |
806 | if (DebugOpt) | 806 | if (DebugOpt) |
807 | log("\005 LINE %s\n", line->cl_Shell); | 807 | crondlog("\005 LINE %s\n", line->cl_Shell); |
808 | #endif | 808 | #endif |
809 | if (line->cl_Mins[tp->tm_min] && | 809 | if (line->cl_Mins[tp->tm_min] && |
810 | line->cl_Hrs[tp->tm_hour] && | 810 | line->cl_Hrs[tp->tm_hour] && |
@@ -813,10 +813,10 @@ TestJobs(time_t t1, time_t t2) | |||
813 | ) { | 813 | ) { |
814 | #ifdef FEATURE_DEBUG_OPT | 814 | #ifdef FEATURE_DEBUG_OPT |
815 | if (DebugOpt) | 815 | if (DebugOpt) |
816 | log("\005 JobToDo: %d %s\n", line->cl_Pid, line->cl_Shell); | 816 | crondlog("\005 JobToDo: %d %s\n", line->cl_Pid, line->cl_Shell); |
817 | #endif | 817 | #endif |
818 | if (line->cl_Pid > 0) { | 818 | if (line->cl_Pid > 0) { |
819 | log("\010 process already running: %s %s\n", | 819 | crondlog("\010 process already running: %s %s\n", |
820 | file->cf_User, | 820 | file->cf_User, |
821 | line->cl_Shell | 821 | line->cl_Shell |
822 | ); | 822 | ); |
@@ -848,7 +848,7 @@ RunJobs(void) | |||
848 | 848 | ||
849 | RunJob(file->cf_User, line); | 849 | RunJob(file->cf_User, line); |
850 | 850 | ||
851 | log("\010USER %s pid %3d cmd %s\n", | 851 | crondlog("\010USER %s pid %3d cmd %s\n", |
852 | file->cf_User, | 852 | file->cf_User, |
853 | line->cl_Pid, | 853 | line->cl_Pid, |
854 | line->cl_Shell | 854 | line->cl_Shell |
@@ -927,7 +927,7 @@ ForkJob(const char *user, CronLine *line, int mailFd, | |||
927 | 927 | ||
928 | #ifdef FEATURE_DEBUG_OPT | 928 | #ifdef FEATURE_DEBUG_OPT |
929 | if (DebugOpt) | 929 | if (DebugOpt) |
930 | log("\005Child Running %s\n", prog); | 930 | crondlog("\005Child Running %s\n", prog); |
931 | #endif | 931 | #endif |
932 | 932 | ||
933 | if (mailFd >= 0) { | 933 | if (mailFd >= 0) { |
@@ -936,7 +936,7 @@ ForkJob(const char *user, CronLine *line, int mailFd, | |||
936 | close(mailFd); | 936 | close(mailFd); |
937 | } | 937 | } |
938 | execl(prog, prog, cmd, arg, NULL); | 938 | execl(prog, prog, cmd, arg, NULL); |
939 | log("\024unable to exec, user %s cmd %s %s %s\n", user, | 939 | crondlog("\024unable to exec, user %s cmd %s %s %s\n", user, |
940 | prog, cmd, arg); | 940 | prog, cmd, arg); |
941 | if(mailf) | 941 | if(mailf) |
942 | fdprintf(1, "Exec failed: %s -c %s\n", prog, arg); | 942 | fdprintf(1, "Exec failed: %s -c %s\n", prog, arg); |
@@ -945,7 +945,7 @@ ForkJob(const char *user, CronLine *line, int mailFd, | |||
945 | /* | 945 | /* |
946 | * FORK FAILED | 946 | * FORK FAILED |
947 | */ | 947 | */ |
948 | log("\024couldn't fork, user %s\n", user); | 948 | crondlog("\024couldn't fork, user %s\n", user); |
949 | line->cl_Pid = 0; | 949 | line->cl_Pid = 0; |
950 | if(mailf) | 950 | if(mailf) |
951 | remove(mailf); | 951 | remove(mailf); |
@@ -993,7 +993,7 @@ RunJob(const char *user, CronLine *line) | |||
993 | line->cl_Shell); | 993 | line->cl_Shell); |
994 | line->cl_MailPos = lseek(mailFd, 0, 1); | 994 | line->cl_MailPos = lseek(mailFd, 0, 1); |
995 | } else { | 995 | } else { |
996 | log("\024unable to create mail file user %s file %s, output to /dev/null\n", | 996 | crondlog("\024unable to create mail file user %s file %s, output to /dev/null\n", |
997 | user, mailFile); | 997 | user, mailFile); |
998 | } | 998 | } |
999 | 999 | ||
@@ -1081,18 +1081,18 @@ RunJob(const char *user, CronLine *line) | |||
1081 | 1081 | ||
1082 | #ifdef FEATURE_DEBUG_OPT | 1082 | #ifdef FEATURE_DEBUG_OPT |
1083 | if (DebugOpt) | 1083 | if (DebugOpt) |
1084 | log("\005Child Running %s\n", def_sh); | 1084 | crondlog("\005Child Running %s\n", def_sh); |
1085 | #endif | 1085 | #endif |
1086 | 1086 | ||
1087 | execl(def_sh, def_sh, "-c", line->cl_Shell, NULL); | 1087 | execl(def_sh, def_sh, "-c", line->cl_Shell, NULL); |
1088 | log("\024unable to exec, user %s cmd %s -c %s\n", user, | 1088 | crondlog("\024unable to exec, user %s cmd %s -c %s\n", user, |
1089 | def_sh, line->cl_Shell); | 1089 | def_sh, line->cl_Shell); |
1090 | exit(0); | 1090 | exit(0); |
1091 | } else if (pid < 0) { | 1091 | } else if (pid < 0) { |
1092 | /* | 1092 | /* |
1093 | * FORK FAILED | 1093 | * FORK FAILED |
1094 | */ | 1094 | */ |
1095 | log("\024couldn't fork, user %s\n", user); | 1095 | crondlog("\024couldn't fork, user %s\n", user); |
1096 | pid = 0; | 1096 | pid = 0; |
1097 | } | 1097 | } |
1098 | line->cl_Pid = pid; | 1098 | line->cl_Pid = pid; |