From 2e7a1a3ded4ea2a54b9e258b500569781874d05c Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 9 Nov 2015 18:03:19 +0100 Subject: [PATCH 1/2] CID 32208 Time of check time of use --- src/reports.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reports.c b/src/reports.c index 27f3a5c28..ca1cfb0f3 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1541,8 +1541,8 @@ static void prepare_report(struct report_context *ctx, faction *f) } static void mkreportdir(const char *rpath) { - if (_access(rpath, 0) < 0) { - if (_mkdir(rpath) != 0) { + if (_mkdir(rpath) != 0) { + if (_access(rpath, 0) < 0) { log_error("could not create reports directory %s: %s", rpath, strerror(errno)); abort(); } From 9ff6aa0d4227c7fc5e819d27c69c3dc476b3be0c Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 9 Nov 2015 18:06:11 +0100 Subject: [PATCH 2/2] CID 22472 Division or modulo by zero CID 22471 Division or modulo by zero github issue #350 github issue #349 --- src/market.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/market.c b/src/market.c index a4158e48d..68ef9767c 100644 --- a/src/market.c +++ b/src/market.c @@ -96,8 +96,8 @@ void do_markets(void) const struct race *rc = f ? f->race : NULL; int p = rpeasants(r); int numlux = rc_luxury_trade(rc), numherbs = rc_herb_trade(rc); - numlux = (p + numlux - MIN_PEASANTS) / numlux; - numherbs = (p + numherbs - MIN_PEASANTS) / numherbs; + if (numlux>0) numlux = (p + numlux - MIN_PEASANTS) / numlux; + if (numherbs>0) numherbs = (p + numherbs - MIN_PEASANTS) / numherbs; if (numlux > 0 || numherbs > 0) { int d, nmarkets = 0; const item_type *lux = r_luxury(r);