diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 19:03:11 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 19:03:11 +0200 |
commit | 20b85c03e751b4876fa3c92040464e483172b746 (patch) | |
tree | 734fadbfdbc143ec4465093857f4c239448715e0 /src/qmail-local.c | |
parent | a6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (diff) |
manual format adjustment
Diffstat (limited to 'src/qmail-local.c')
-rw-r--r-- | src/qmail-local.c | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/qmail-local.c b/src/qmail-local.c index 4479e9b..02040f8 100644 --- a/src/qmail-local.c +++ b/src/qmail-local.c @@ -31,6 +31,7 @@ #include "qmail.h" #include "quote.h" + /** @file qmail-local local delivery agent to Mailbox and Maildir @@ -49,26 +50,32 @@ void temp_nomem() { logmsg(WHO, 111, FATAL, "Out of memory. (#4.3.0)"); } + void temp_rewind() { logmsg(WHO, 111, FATAL, "Unable to rewind message. (#4.3.0)"); } + void temp_childcrashed() { logmsg(WHO, 111, FATAL, "Aack, child crashed. (#4.3.0)"); } + void temp_fork() { logmsg(WHO, 111, FATAL, B("Unable to fork: ", error_str(errno), ". (#4.3.0)")); } + void temp_read() { logmsg(WHO, 111, ERROR, B("Unable to read message: ", error_str(errno), ". (#4.3.0)")); } + void temp_slowlock() { logmsg(WHO, 111, ERROR, "File has been locked for 30 seconds straight. (#4.3.0)"); } + void temp_qmail(fn) char *fn; { logmsg(WHO, 111, FATAL, B("Unable to open: ", fn, " ", error_str(errno), ". (#4.3.0)")); @@ -105,10 +112,12 @@ char bufout[1024]; char fntmptph[80 + FMT_ULONG * 2]; char fnnewtph[80 + FMT_ULONG * 2]; + void tryunlinktmp() { unlink(fntmptph); } + void sigalrm() { tryunlinktmp(); @@ -401,11 +410,12 @@ void checkhome() if (stat(".", &st) == -1) logmsg(WHO, 111, ERROR, B("Unable to stat home directory: ", error_str(errno), ". (#4.3.0)")); if (st.st_mode & auto_patrn) logmsg(WHO, 111, ERROR, "Uh-oh: home directory is writable. (#4.7.0)"); - if (st.st_mode & 01000) + if (st.st_mode & 01000) { if (flagdoit) logmsg(WHO, 111, ERROR, "Home directory is sticky: user is editing his .qmail file. (#4.2.1)"); else logmsg(WHO, 0, WARN, "Warning: home directory is sticky."); + } } int qmeox(char *dashowner) @@ -474,7 +484,7 @@ void qmesearch(int *fd, int *cutable) return; } - for (i = safeext.len; i >= 0; --i) + for (i = safeext.len; i >= 0; --i) { if (!i || (safeext.s[i - 1] == '-')) { if (!stralloc_copys(&qme, ".qmail")) temp_nomem(); if (!stralloc_cats(&qme, dash)) temp_nomem(); @@ -486,6 +496,7 @@ void qmesearch(int *fd, int *cutable) return; } } + } *fd = -1; } @@ -539,12 +550,13 @@ int main(int argc, char **argv) if (!env_init()) temp_nomem(); flagdoit = 1; - while ((opt = getopt(argc, argv, "nN")) != opteof) switch (opt) - { + while ((opt = getopt(argc, argv, "nN")) != opteof) { + switch (opt) { case 'n': flagdoit = 0; break; case 'N': flagdoit = 1; break; default: usage(); } + } argc -= optind; argv += optind; @@ -572,10 +584,12 @@ int main(int argc, char **argv) if (str_len(ext) > 1) { i = str_chr(local, *auto_break); if (!stralloc_copys(&envrecip, local + i + 1)) temp_nomem(); - } else + } else { +#else + { #endif - if (!stralloc_copys(&envrecip, local)) - temp_nomem(); + if (!stralloc_copys(&envrecip, local)) temp_nomem(); + } if (!stralloc_cats(&envrecip, "@")) temp_nomem(); if (!stralloc_cats(&envrecip, host)) temp_nomem(); @@ -708,7 +722,7 @@ int main(int argc, char **argv) numforward = 0; i = 0; - for (j = 0; j < cmds.len; ++j) + for (j = 0; j < cmds.len; ++j) { if (cmds.s[j] == '\n') { switch (cmds.s[i]) { case '#': @@ -719,6 +733,7 @@ int main(int argc, char **argv) } i = j + 1; } + } recips = (char **)alloc((numforward + 1) * sizeof(char *)); if (!recips) temp_nomem(); @@ -727,12 +742,13 @@ int main(int argc, char **argv) flag99 = 0; i = 0; - for (j = 0; j < cmds.len; ++j) + for (j = 0; j < cmds.len; ++j) { if (cmds.s[j] == '\n') { cmds.s[j] = 0; k = j; /* Patch contributed by Erik Sjolund <erik.sjolund@gmail.com>. */ while ((k > i) && ((cmds.s[k - 1] == ' ') || (cmds.s[k - 1] == '\t'))) cmds.s[--k] = 0; + switch (cmds.s[i]) { case 0: /* k == i */ if (i) break; @@ -777,12 +793,12 @@ int main(int argc, char **argv) i = j + 1; if (flag99) break; } + } - if (numforward) - if (flagdoit) { - recips[numforward] = 0; - mailforward(recips); - } + if (numforward && flagdoit) { + recips[numforward] = 0; + mailforward(recips); + } count_print(); _exit(0); |