Article View: gnu.chess
Article #4231Bug fix for cmail (corrected)
From: Tim Mann
Date: Thu, 12 Oct 1995 00:00
Date: Thu, 12 Oct 1995 00:00
54 lines
2155 bytes
2155 bytes
If you are having trouble with cmail (from the xboard package, version
3.3.pl3 or earlier), particularly if it fails with a message about not
being able to find the BlackNA tag, apply the following patch to
pgntags.c and recompile xboard.
I'm a bit embarrassed about this bug. I didn't make the coding error
myself, but I didn't look carefully enough at some submitted code to
notice it. I'm even more embarrassed because I posted a patch that
didn't compile on my first try.
--Tim
*** pgntags.c 1995/07/28 05:23:42 1.4
--- pgntags.c 1995/10/12 19:48:32
***************
*** 104,122 ****
oldTags = "";
} else {
oldTags = gameInfo->extraTags;
- free(gameInfo->extraTags);
}
/* Buffer size includes 7 bytes of space for [ ""]\n\0 */
len = strlen(oldTags) + strlen(value) + strlen(name) + 7;
! if ((gameInfo->extraTags = (char *) malloc(len)) != NULL) {
! sprintf(gameInfo->extraTags, "%s[%s \"%s\"]\n",
! oldTags, name, value);
success = TRUE;
} else {
success = FALSE;
}
}
-
return(success ? 0 : ENOMEM);
}
--- 104,121 ----
oldTags = "";
} else {
oldTags = gameInfo->extraTags;
}
/* Buffer size includes 7 bytes of space for [ ""]\n\0 */
len = strlen(oldTags) + strlen(value) + strlen(name) + 7;
! if ((p = (char *) malloc(len)) != NULL) {
! sprintf(p, "%s[%s \"%s\"]\n", oldTags, name, value);
! if (gameInfo->extraTags != NULL) free(gameInfo->extraTags);
! gameInfo->extraTags = p;
success = TRUE;
} else {
success = FALSE;
}
}
return(success ? 0 : ENOMEM);
}
Technical Details
Message-ID:
<45jrls$hbv@src-news.pa.dec.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d71d,5570c20003a8fec6,start X-Google-Attributes: gid10d71d,public From: mann@src.dec.com (Tim Mann) Subject: Bug fix for cmail (corrected) Date: 1995/10/12 Message-ID: <45jrls$hbv@src-news.pa.dec.com> X-Deja-AN: 117461257 distribution: world supersedes: <45jr8e$gqj@src-news.pa.dec.com> organization: Digital Equipment Corp., Systems Research Center reply-to: mann@pa.dec.com newsgroups: gnu.chess