summaryrefslogtreecommitdiff
path: root/src/qmail-badloadertypes.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
commita6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (patch)
treeb88cc7a8457658d67e0321718556ac807f6bccf3 /src/qmail-badloadertypes.c
parent00be7622c428f279872f84569f098ce16150f8a8 (diff)
format files
Diffstat (limited to 'src/qmail-badloadertypes.c')
-rw-r--r--src/qmail-badloadertypes.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/qmail-badloadertypes.c b/src/qmail-badloadertypes.c
index 3472fd5..779c73a 100644
--- a/src/qmail-badloadertypes.c
+++ b/src/qmail-badloadertypes.c
@@ -1,27 +1,30 @@
+#include <sys/stat.h>
#include <unistd.h>
+
#include <stdlib.h>
-#include <sys/stat.h>
-#include "logmsg.h"
-#include "stralloc.h"
+
#include "buffer.h"
-#include "getln.h"
+#include "cdbmake.h"
#include "exit.h"
+#include "getln.h"
+#include "logmsg.h"
#include "open.h"
+#include "stralloc.h"
+
#include "auto_qmail.h"
-#include "cdbmake.h"
-#define WHO "qmail-badloadertypes"
+#define WHO "qmail-badloadertypes"
#define LOADER_LEN 5
-int rename(const char *,const char *); // stdio.h
+int rename(const char *, const char *); // stdio.h
void die_read()
{
- logmsg(WHO,111,FATAL,"unable to read control/badloadertypes");
+ logmsg(WHO, 111, FATAL, "unable to read control/badloadertypes");
}
void die_write()
{
- logmsg(WHO,111,FATAL,"unable to write to control/badloadertypes.tmp");
+ logmsg(WHO, 111, FATAL, "unable to write to control/badloadertypes.tmp");
}
char inbuf[1024];
@@ -37,32 +40,30 @@ int match;
int main()
{
umask(033);
- if (chdir(auto_qmail) == -1)
- logmsg(WHO,111,FATAL,B("unable to chdir to: ",auto_qmail));
+ if (chdir(auto_qmail) == -1) logmsg(WHO, 111, FATAL, B("unable to chdir to: ", auto_qmail));
fd = open_read("control/badloadertypes");
if (fd == -1) die_read();
- buffer_init(&b,read,fd,inbuf,sizeof(inbuf));
+ buffer_init(&b, read, fd, inbuf, sizeof(inbuf));
fdtemp = open_trunc("control/badloadertypes.tmp");
if (fdtemp == -1) die_write();
- if (cdb_make_start(&cdb,fdtemp) == -1) die_write();
+ if (cdb_make_start(&cdb, fdtemp) == -1) die_write();
for (;;) {
- if (getln(&b,&line,&match,'\n') != 0) die_read();
+ if (getln(&b, &line, &match, '\n') != 0) die_read();
if (line.s[0] != '#' && line.len > LOADER_LEN)
- if (cdb_make_add(&cdb,line.s,LOADER_LEN,"",0) == -1)
- die_write();
+ if (cdb_make_add(&cdb, line.s, LOADER_LEN, "", 0) == -1) die_write();
if (!match) break;
}
if (cdb_make_finish(&cdb) == -1) die_write();
if (fsync(fdtemp) == -1) die_write();
if (close(fdtemp) == -1) die_write(); /* NFS stupidity */
- if (rename("control/badloadertypes.tmp","control/badloadertypes.cdb") == -1)
- logmsg(WHO,111,FATAL,"unable to move control/badloadertypes.tmp to control/badloadertypes.cdb");
+ if (rename("control/badloadertypes.tmp", "control/badloadertypes.cdb") == -1)
+ logmsg(WHO, 111, FATAL, "unable to move control/badloadertypes.tmp to control/badloadertypes.cdb");
_exit(0);
}