]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/anno.c
Update copyright notice
[empserver] / src / lib / update / anno.c
index f78c77535749061023b5f69d30d686e564377fc2..af4d4f107bf7071b5a08575e3bd6c6d6bd57c6f4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
  *     Ken Stevens, 1995
  *     Doug Hay, 1998
  *     Steve McClure, 2000
+ *     Ron Koenderink, 2004
  */
 
 #include <config.h>
 
-#include "misc.h"
-#include "tel.h"
-#include <fcntl.h>
+#if defined(_WIN32) && defined(__GNUC__)
+#include <io.h>
+#endif
 #include <stdio.h>
 #include <time.h>
-#if !defined(_WIN32)
-#include <unistd.h>
-#endif
+#include "tel.h"
 #include "update.h"
-#include "optlist.h"
-#include "common.h"
 
 static int copy_and_expire(FILE *annfp, FILE *tmpfp,
                           char *tmp_filename, time_t expiry_time);
@@ -102,6 +99,9 @@ delete_old_announcements(void)
        if (rename(tmp_filename, annfil) != 0)
            logerror("can't move temporary telegram file %s "
                     "to telegram file %s", tmp_filename, annfil);
+    } else {
+       if (remove(tmp_filename) < 0)
+           logerror("can't delete telegram file %s", tmp_filename);
     }
 }
 
@@ -146,14 +146,14 @@ copy_and_expire(FILE *annfp, FILE *tmpfp, char *tmp_filename,
            ++saved;
        } else
            ++deleted;
-       if (fread(message, sizeof(char), tgm.tel_length, annfp) !=
+       if (fread(message, 1, tgm.tel_length, annfp) !=
            (size_t)tgm.tel_length) {
            logerror("error reading body from telegram file %s",
                     annfil);
            return 0;
        }
        if (writeit) {
-           if (fwrite(message, sizeof(char), tgm.tel_length, tmpfp) !=
+           if (fwrite(message, 1, tgm.tel_length, tmpfp) !=
                (size_t)tgm.tel_length) {
                logerror("error writing body to temporary telegram "
                         "file %s", tmp_filename);