From 0e275b8507b946f7a9e1e7fdbc503212376047e0 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 15 Nov 2007 19:42:28 +0000 Subject: [PATCH] (load_plane_ship, load_land_ship, load_plane_land, load_land_land): isdigit() can return anything, not just 0 or 1, and you can't combine its values with &=! The bug could make loading operations fail noisily instead of silently, depending on the system's implementation of isdigit(). --- src/lib/commands/load.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/commands/load.c b/src/lib/commands/load.c index 2db1a8f3..0af4aa5e 100644 --- a/src/lib/commands/load.c +++ b/src/lib/commands/load.c @@ -377,8 +377,8 @@ load_plane_ship(struct sctstr *sectp, struct shpstr *sp, int noisy, if (!still_ok_ship(sectp, sp)) return RET_SYN; - if (p && *p) - noisy &= isdigit(*p); + if (noisy && p && *p) + noisy = isdigit(*p); while (nxtitem(&ni, &pln)) { if (pln.pln_own != player->cnum) @@ -506,8 +506,8 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy, if (!still_ok_ship(sectp, sp)) return RET_SYN; - if (p && *p) - noisy &= isdigit(*p); + if (noisy && p && *p) + noisy = isdigit(*p); while (nxtitem(&ni, &land)) { if (land.lnd_own != player->cnum) @@ -767,8 +767,8 @@ load_plane_land(struct sctstr *sectp, struct lndstr *lp, int noisy, if (!still_ok_land(sectp, lp)) return RET_SYN; - if (p && *p) - noisy &= isdigit(*p); + if (noisy && p && *p) + noisy = isdigit(*p); if (sectp->sct_own != player->cnum && load_unload == LOAD) { pr("Sector %s is not yours.\n", @@ -950,8 +950,8 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy, if (!still_ok_land(sectp, lp)) return RET_SYN; - if (p && *p) - noisy &= isdigit(*p); + if (noisy && p && *p) + noisy = isdigit(*p); while (nxtitem(&ni, &land)) {