bug-cvs
[Top][All Lists]
Advanced

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

Re: Freeing non-heap pointer in normalize_cvsroot


From: Jon Miner
Subject: Re: Freeing non-heap pointer in normalize_cvsroot
Date: Wed, 18 Oct 2000 15:24:41 -0500
User-agent: Mutt/1.2i

* Jon Miner (miner@doit.wisc.edu) [001018 15:20]:
> The patch is attached for your thoughts..  It's not ready for prime
> time, but I've got to get back to my day job. :)

But I do have time to fix up one little thing in the patch that I
forgot.

Here's the corrected version:

Index: src/login.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/login.c,v
retrieving revision 1.59
diff -u -r1.59 login.c
--- src/login.c 2000/10/17 18:42:28 1.59
+++ src/login.c 2000/10/18 20:24:35
@@ -320,6 +320,9 @@
     char *passfile;
     int line_length;
     char *cvsroot_canonical;
+    char port_s[11];
+    char * tmpbuf;
+    char *p;
 
     if (CVSroot_password)
    return (scramble(CVSroot_password));
@@ -367,6 +370,21 @@
     /* Check each line to see if we have this entry already. */
     while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
     {
+    p = strchr(linebuf, '@'); /* Find the @ */
+    p = strchr(p, ':');       /* And the next : is followed by the port/path */
+    if (!isdigit(*(p + 1))) 
+       {
+           sprintf (port_s, "%d", get_port_number ("CVS_CLIENT_PORT", 
"cvspserver", CVS_AUTH_PORT));
+
+           tmpbuf = xmalloc(strlen(linebuf) + strlen(port_s) + 1);
+
+           *p = '\0';
+           p++;
+           sprintf(tmpbuf, "%s:%s%s", linebuf, port_s, p);
+
+           linebuf = tmpbuf;
+           line_length = linebuf_len = strlen(tmpbuf);
+       }
    if (strncmp (cvsroot_canonical, linebuf, root_len) == 0)
         {
        /* This is it!  So break out and deal with linebuf. */


-- 
.Jonathan J. Miner------------------Division of Information Technology.
|miner@doit.wisc.edu                 University Of Wisconsin - Madison|
|608/262.9655                               Room 3149 Computer Science|
`---------------------------------------------------------------------'

 Y'know, there are other possibilities if we assume that filenames
 are UTF-8...yikes...wait, put down that meat cleaver!  Aieeee!!!
              -- Larry Wall in <199806181655.JAA10702@wall.org>
                                                                 (245)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]