diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 11:44:11 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 11:44:11 +0200 |
commit | f1b71c9fe7dbb4886588a036399cf5ebe16b7c47 (patch) | |
tree | e07786aa479c9fb6ee3e537078470aaab5454f80 /sqmail-4.3.07/src/qmail-badmimetypes.c | |
parent | a293489ee83c8b05d845a162dc2a4de026f3775d (diff) |
removed top level directory
Diffstat (limited to 'sqmail-4.3.07/src/qmail-badmimetypes.c')
-rw-r--r-- | sqmail-4.3.07/src/qmail-badmimetypes.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/sqmail-4.3.07/src/qmail-badmimetypes.c b/sqmail-4.3.07/src/qmail-badmimetypes.c deleted file mode 100644 index a75ad4c..0000000 --- a/sqmail-4.3.07/src/qmail-badmimetypes.c +++ /dev/null @@ -1,67 +0,0 @@ -#include <unistd.h> -#include <sys/stat.h> -#include "logmsg.h" -#include "stralloc.h" -#include "buffer.h" -#include "getln.h" -#include "exit.h" -#include "open.h" -#include "auto_qmail.h" -#include "cdbmake.h" - -#define WHO "qmail-badmimetypes" -#define MIMETYPE_LEN 9 - -int rename(const char *,const char *); // stdio.h - -void die_read() -{ - logmsg(WHO,111,FATAL,"unable to read control/badmimetypes"); -} -void die_write() -{ - logmsg(WHO,111,FATAL,"unable to write to control/badmimetypes.tmp"); -} - -char inbuf[1024]; -buffer b; - -int fd; -int fdtemp; - -struct cdb_make cdb; -stralloc line = {0}; -int match; - -int main() -{ - umask(033); - if (chdir(auto_qmail) == -1) - logmsg(WHO,111,FATAL,B("unable to chdir to: ",auto_qmail)); - - fd = open_read("control/badmimetypes"); - if (fd == -1) die_read(); - - buffer_init(&b,read,fd,inbuf,sizeof(inbuf)); - - fdtemp = open_trunc("control/badmimetypes.tmp"); - if (fdtemp == -1) die_write(); - - if (cdb_make_start(&cdb,fdtemp) == -1) die_write(); - - for (;;) { - if (getln(&b,&line,&match,'\n') != 0) die_read(); - if (line.s[0] != '#' && line.len > MIMETYPE_LEN) - if (cdb_make_add(&cdb,line.s,MIMETYPE_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/badmimetypes.tmp","control/badmimetypes.cdb") == -1) - logmsg(WHO,111,FATAL,"unable to move control/badmimetypes.tmp to control/badmimetypes.cdb"); - - _exit(0); -} |