diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-17 14:28:53 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-17 14:28:53 +0000 |
commit | cb448fe01bbe75ef31c3190e8b63b0e1a320ffb4 (patch) | |
tree | 9757477193c1b8f3be9a772cabfb1ef92639240e /miscutils | |
parent | ffae845cfd0a0b9872827d806984841d4cfee104 (diff) | |
download | busybox-w32-cb448fe01bbe75ef31c3190e8b63b0e1a320ffb4.tar.gz busybox-w32-cb448fe01bbe75ef31c3190e8b63b0e1a320ffb4.tar.bz2 busybox-w32-cb448fe01bbe75ef31c3190e8b63b0e1a320ffb4.zip |
libbb: introduce and use xrename and rename_or_warn.
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/crond.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c index 0df143ae7..9721a8a9a 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c | |||
@@ -548,7 +548,7 @@ static void CheckUpdates(void) | |||
548 | 548 | ||
549 | fi = fopen(CRONUPDATE, "r"); | 549 | fi = fopen(CRONUPDATE, "r"); |
550 | if (fi != NULL) { | 550 | if (fi != NULL) { |
551 | remove(CRONUPDATE); | 551 | unlink(CRONUPDATE); |
552 | while (fgets(buf, sizeof(buf), fi) != NULL) { | 552 | while (fgets(buf, sizeof(buf), fi) != NULL) { |
553 | SynchronizeFile(strtok(buf, " \t\r\n")); | 553 | SynchronizeFile(strtok(buf, " \t\r\n")); |
554 | } | 554 | } |
@@ -579,7 +579,7 @@ static void SynchronizeDir(void) | |||
579 | * scan directory and add associated users | 579 | * scan directory and add associated users |
580 | */ | 580 | */ |
581 | 581 | ||
582 | remove(CRONUPDATE); | 582 | unlink(CRONUPDATE); |
583 | if (chdir(CDir) < 0) { | 583 | if (chdir(CDir) < 0) { |
584 | crondlog("\311cannot find %s\n", CDir); | 584 | crondlog("\311cannot find %s\n", CDir); |
585 | } | 585 | } |
@@ -814,7 +814,7 @@ ForkJob(const char *user, CronLine * line, int mailFd, | |||
814 | crondlog("\024cannot fork\n"); | 814 | crondlog("\024cannot fork\n"); |
815 | line->cl_Pid = 0; | 815 | line->cl_Pid = 0; |
816 | if (mail_filename) { | 816 | if (mail_filename) { |
817 | remove(mail_filename); | 817 | unlink(mail_filename); |
818 | } | 818 | } |
819 | } else if (mail_filename) { | 819 | } else if (mail_filename) { |
820 | /* PARENT, FORK SUCCESS | 820 | /* PARENT, FORK SUCCESS |
@@ -823,7 +823,7 @@ ForkJob(const char *user, CronLine * line, int mailFd, | |||
823 | char mailFile2[128]; | 823 | char mailFile2[128]; |
824 | 824 | ||
825 | snprintf(mailFile2, sizeof(mailFile2), TMPDIR "/cron.%s.%d", user, pid); | 825 | snprintf(mailFile2, sizeof(mailFile2), TMPDIR "/cron.%s.%d", user, pid); |
826 | rename(mail_filename, mailFile2); | 826 | rename(mail_filename, mailFile2); // TODO: xrename? |
827 | } | 827 | } |
828 | /* | 828 | /* |
829 | * Close the mail file descriptor.. we can't just leave it open in | 829 | * Close the mail file descriptor.. we can't just leave it open in |
@@ -896,7 +896,7 @@ static void EndJob(const char *user, CronLine * line) | |||
896 | */ | 896 | */ |
897 | 897 | ||
898 | mailFd = open(mailFile, O_RDONLY); | 898 | mailFd = open(mailFile, O_RDONLY); |
899 | remove(mailFile); | 899 | unlink(mailFile); |
900 | if (mailFd < 0) { | 900 | if (mailFd < 0) { |
901 | return; | 901 | return; |
902 | } | 902 | } |