Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl2/xcvs/dist/src Make sure that all messages end ...



details:   https://anonhg.NetBSD.org/src/rev/12d87ede1bde
branches:  trunk
changeset: 815640:12d87ede1bde
user:      christos <christos%NetBSD.org@localhost>
date:      Mon May 30 17:49:51 2016 +0000

description:
Make sure that all messages end in '\n' in make_message_rcsvalid() and
compensate for it in add_rcs_file().

diffstat:

 external/gpl2/xcvs/dist/src/import.c |   8 ++++----
 external/gpl2/xcvs/dist/src/subr.c   |  12 +++++++++---
 2 files changed, 13 insertions(+), 7 deletions(-)

diffs (75 lines):

diff -r d59e63406b92 -r 12d87ede1bde external/gpl2/xcvs/dist/src/import.c
--- a/external/gpl2/xcvs/dist/src/import.c      Mon May 30 17:48:29 2016 +0000
+++ b/external/gpl2/xcvs/dist/src/import.c      Mon May 30 17:49:51 2016 +0000
@@ -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 @@
            /* 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 @@
            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 @@
                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;
        }
diff -r d59e63406b92 -r 12d87ede1bde external/gpl2/xcvs/dist/src/subr.c
--- a/external/gpl2/xcvs/dist/src/subr.c        Mon May 30 17:48:29 2016 +0000
+++ b/external/gpl2/xcvs/dist/src/subr.c        Mon May 30 17:49:51 2016 +0000
@@ -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 @@
     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 @@
     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;



Home | Main Index | Thread Index | Old Index