mdeliver: clean up logic

pull/159/head
Leah Neukirchen 6 years ago
parent 65ddebc87c
commit 4e9237f921

@ -93,7 +93,7 @@ deliver(char *infilename)
} }
} }
while (!infile || !feof(infile)) { do {
delivery++; delivery++;
try_again: try_again:
gettimeofday(&tv, 0); gettimeofday(&tv, 0);
@ -107,11 +107,9 @@ try_again:
if (try_rename) { if (try_rename) {
snprintf(dst, sizeof dst, "%s/%s/%s:2,%s", snprintf(dst, sizeof dst, "%s/%s/%s:2,%s",
targetdir, cflag ? "cur" : "new", id, Xflag); targetdir, cflag ? "cur" : "new", id, Xflag);
if (rename(infilename, dst) == 0) { if (rename(infilename, dst) == 0)
if (vflag)
printf("%s\n", dst);
goto success; goto success;
}
/* rename failed, open file and try copying */ /* rename failed, open file and try copying */
infile = fopen(infilename, "r"); infile = fopen(infilename, "r");
@ -238,11 +236,11 @@ try_again:
if (rename(tmp, dst) != 0) if (rename(tmp, dst) != 0)
goto fail; goto fail;
success:
if (vflag) if (vflag)
printf("%s\n", dst); printf("%s\n", dst);
} } while (Mflag && !feof(infile));
success:
if (infile) if (infile)
fclose(infile); fclose(infile);
return 0; return 0;

Loading…
Cancel
Save