Module Name: src Committed By: christos Date: Mon May 30 17:49:51 UTC 2016
Modified Files: src/external/gpl2/xcvs/dist/src: import.c subr.c Log Message: Make sure that all messages end in '\n' in make_message_rcsvalid() and compensate for it in add_rcs_file(). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/gpl2/xcvs/dist/src/import.c cvs rdiff -u -r1.3 -r1.4 src/external/gpl2/xcvs/dist/src/subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl2/xcvs/dist/src/import.c diff -u src/external/gpl2/xcvs/dist/src/import.c:1.6 src/external/gpl2/xcvs/dist/src/import.c:1.7 --- src/external/gpl2/xcvs/dist/src/import.c:1.6 Tue May 17 10:00:09 2016 +++ src/external/gpl2/xcvs/dist/src/import.c Mon May 30 13:49:51 2016 @@ -21,7 +21,7 @@ * Additional arguments specify more Vendor Release Tags. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: import.c,v 1.6 2016/05/17 14:00:09 christos Exp $"); +__RCSID("$NetBSD: import.c,v 1.7 2016/05/30 17:49:51 christos Exp $"); #include "cvs.h" #include "lstat.h" @@ -1409,7 +1409,7 @@ add_rcs_file (const char *message, const /* We are going to put the log message in the revision on the branch. So putting it here too seems kind of redundant, I guess (and that is what CVS has always done, anyway). */ - if (fprintf (fprcs, "Initial revision") < 0) + if (fprintf (fprcs, "Initial revision\n") < 0) goto write_error; } else @@ -1417,7 +1417,7 @@ add_rcs_file (const char *message, const if (expand_at_signs (message, (off_t) strlen (message), fprcs) < 0) goto write_error; } - if (fprintf (fprcs, "\012@\012") < 0 || + if (fprintf (fprcs, "@\012") < 0 || fprintf (fprcs, "text\012@") < 0) { goto write_error; @@ -1443,7 +1443,7 @@ add_rcs_file (const char *message, const fprintf (fprcs, "log\012@") < 0 || expand_at_signs (message, (off_t) strlen (message), fprcs) < 0 || - fprintf (fprcs, "\012@\012text\012") < 0 || + fprintf (fprcs, "@\012text\012") < 0 || fprintf (fprcs, "@@\012") < 0) goto write_error; } Index: src/external/gpl2/xcvs/dist/src/subr.c diff -u src/external/gpl2/xcvs/dist/src/subr.c:1.3 src/external/gpl2/xcvs/dist/src/subr.c:1.4 --- src/external/gpl2/xcvs/dist/src/subr.c:1.3 Tue May 17 10:00:09 2016 +++ src/external/gpl2/xcvs/dist/src/subr.c Mon May 30 13:49:51 2016 @@ -13,7 +13,7 @@ * Various useful functions for the CVS support code. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: subr.c,v 1.3 2016/05/17 14:00:09 christos Exp $"); +__RCSID("$NetBSD: subr.c,v 1.4 2016/05/30 17:49:51 christos Exp $"); #include "cvs.h" @@ -542,7 +542,8 @@ make_message_rcsvalid (const char *messa if (message == NULL) message = ""; /* Strip whitespace from end of lines and end of string. */ - dp = dst = (char *) xmalloc (strlen (message) + 1); + /* One for NUL, one for \n */ + dp = dst = xmalloc (strlen (message) + 2); for (mp = message; *mp != '\0'; ++mp) { if (*mp == '\n') @@ -564,7 +565,12 @@ make_message_rcsvalid (const char *messa if (*dst == '\0') { free (dst); - dst = xstrdup ("*** empty log message ***"); + dst = xstrdup ("*** empty log message ***\n"); + } + else if (dp > dst && dp[-1] != '\n') + { + *dp++ = '\n'; + *dp++ = '\0'; } return dst;