| Summary: | [PATCH] fix for detecting empty CVS commit log message | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Mark Valentine <mark> | ||||
| Component: | gnu | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 5.0-CURRENT | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
Mark Valentine
2001-06-16 04:20:04 UTC
Here's a new patch incorporating the official fix which was checked into the cvs cvs(!) tree; it also fixes a related memory leak. ChangeLog entry as follows: 2001-06-20 Derek Price <dprice@collab.net> * logmsg.c (do_editor): Abort in the case that the file has only comment lines. (Original patch from Mark Valentine <mark@thuvia.demon.co.uk>.) * logmsg.c (do_editor): Fix rare memory leak. Index: contrib/cvs/src/logmsg.c =================================================================== RCS file: /usr/cvs/src/contrib/cvs/src/logmsg.c,v retrieving revision 1.7 diff -u -r1.7 logmsg.c --- contrib/cvs/src/logmsg.c 2000/10/02 06:43:56 1.7 +++ contrib/cvs/src/logmsg.c 2001/06/20 17:08:31 @@ -307,7 +307,7 @@ /* On NT, we might read less than st_size bytes, but we won't read more. So this works. */ *messagep = (char *) xmalloc (post_stbuf.st_size + 1); - *messagep[0] = '\0'; + (*messagep)[0] = '\0'; } line = NULL; @@ -340,8 +340,14 @@ if (pre_stbuf.st_mtime == post_stbuf.st_mtime || *messagep == NULL || + (*messagep)[0] == '\0' || strcmp (*messagep, "\n") == 0) { + if (*messagep) + { + free (*messagep); + *messagep = NULL; + } for (;;) { (void) printf ("\nLog message unchanged or not specified\n"); -- Mark Valentine, Thuvia Labs <mark@thuvia.co.uk> <http://www.thuvia.co.uk> "Tigers will do ANYTHING for a tuna fish sandwich." Mark Valentine uses "We're kind of stupid that way." *munch* *munch* and endorses FreeBSD -- <http://www.calvinandhobbes.com> <http://www.freebsd.org> State Changed From-To: open->analyzed I am currently raising the issue to import cvs 1.11.1p1, don't know yet if this release contains this fix. Will look tonight. State Changed From-To: analyzed->closed Apparently fixed in all supported versions of FreeBSD. |