From 43c2c74d75399f3bc50febff133f423fd262b17f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 13 Aug 2016 10:13:22 +0200 Subject: [PATCH 1/2] correct the list of glacier herbs. this will fix newly created glaciers only. there are several bad glaciers in E2, this commit is not repairing them. https://bugs.eressea.de/view.php?id=2220 --- conf/e2/terrains.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/e2/terrains.json b/conf/e2/terrains.json index a96023ef8..d26c656ea 100644 --- a/conf/e2/terrains.json +++ b/conf/e2/terrains.json @@ -141,7 +141,7 @@ }, "glacier": { "size": 100, - "herbs": [ "h15", "h16", "h17" ], + "herbs": [ "h18", "h19", "h20" ], "seed": 2, "road": 250, "flags": [ "arctic", "land", "walk", "sail", "fly" ], From 3e47f02fc2599fbfe38656e7cfbe98c50bd1c5be Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 9 Aug 2016 18:28:15 +0200 Subject: [PATCH 2/2] coverity CID 141509 Unchecked return value from library Conflicts: src/util/log.c --- src/util/log.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/util/log.c b/src/util/log.c index cc9fafb92..36e81a5df 100644 --- a/src/util/log.c +++ b/src/util/log.c @@ -102,21 +102,29 @@ void log_rotate(const char *filename, int maxindex) assert(strlen(filename) < sizeof(buffer[0]) - 4); sprintf(buffer[dst], "%s.%d", filename, maxindex); -#ifdef HAVE_UNISTD_H - /* make sure we don't overwrite an existing file (hard links) */ - unlink(buffer[dst]); -#endif + if (remove(buffer[dst]) != 0) { + if (errno != ENOENT) { + fprintf(stderr, "log rotate %s: %d %s", buffer[dst], errno, strerror(errno)); + } + errno = 0; + } + while (maxindex > 0) { - int err, src = 1 - dst; + int src = 1 - dst; sprintf(buffer[src], "%s.%d", filename, --maxindex); - err = rename(buffer[src], buffer[dst]); - if (err != 0) { - log_debug("log rotate %s: %s", buffer[dst], strerror(errno)); + if (rename(buffer[src], buffer[dst]) != 0) { + if (errno != ENOENT) { + fprintf(stderr, "log rotate %s: %d %s", buffer[dst], errno, strerror(errno)); + } + errno = 0; } dst = src; } if (rename(filename, buffer[dst]) != 0) { - log_debug("log rotate %s: %s", buffer[dst], strerror(errno)); + if (errno != ENOENT) { + fprintf(stderr, "log rotate %s: %d %s", buffer[dst], errno, strerror(errno)); + } + errno = 0; } }