aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2019-02-10 22:00:29 +0100
committerLeah Neukirchen <leah@vuxu.org>2019-02-10 22:00:29 +0100
commit4e9237f921d753079cb0930bcc0f0f4a5e41939a (patch)
treece815c38b2698fd14f090db62021f6565153c8c7
parent65ddebc87ca2aaa1640deb9d4c75e164e2810d46 (diff)
downloadmblaze-4e9237f921d753079cb0930bcc0f0f4a5e41939a.tar.gz
mdeliver: clean up logic
-rw-r--r--mdeliver.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/mdeliver.c b/mdeliver.c
index 26c85e1..4bff47c 100644
--- a/mdeliver.c
+++ b/mdeliver.c
@@ -93,7 +93,7 @@ deliver(char *infilename)
}
}
- while (!infile || !feof(infile)) {
+ do {
delivery++;
try_again:
gettimeofday(&tv, 0);
@@ -107,11 +107,9 @@ try_again:
if (try_rename) {
snprintf(dst, sizeof dst, "%s/%s/%s:2,%s",
targetdir, cflag ? "cur" : "new", id, Xflag);
- if (rename(infilename, dst) == 0) {
- if (vflag)
- printf("%s\n", dst);
+ if (rename(infilename, dst) == 0)
goto success;
- }
+
/* rename failed, open file and try copying */
infile = fopen(infilename, "r");
@@ -238,11 +236,11 @@ try_again:
if (rename(tmp, dst) != 0)
goto fail;
+success:
if (vflag)
printf("%s\n", dst);
- }
+ } while (Mflag && !feof(infile));
-success:
if (infile)
fclose(infile);
return 0;