]> git.pond.sub.org Git - empserver/commitdiff
(load_plane_ship, load_land_ship, load_plane_land, load_land_land):
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 15 Nov 2007 19:42:28 +0000 (19:42 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 15 Nov 2007 19:42:28 +0000 (19:42 +0000)
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

index 2db1a8f311cda9fb8e37e3302018b18250839ffe..0af4aa5eb204461da6cf029f6c613e9a15633a30 100644 (file)
@@ -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)) {