delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/03/10:34:45

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: cygstart patch
Date: Thu, 3 Mar 2005 10:32:24 -0500
Message-ID: <49D88D820A7BC0479A7B0932D4219EFE1A4BD0@NAEAPAXREX04VA.nadsusea.nads.navy.mil>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Derosa, Anthony CIV NAVAIR 2035, 2, 205/214" <Anthony DOT Derosa1 AT navy DOT mil>
To: <cygwin AT cygwin DOT com>
X-OriginalArrivalTime: 03 Mar 2005 15:32:26.0936 (UTC) FILETIME=[344E3380:01C52006]
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j23FYh2b020227

> But there is an important _process_ problem.  It is the 
> number one sin of CVS to checkin anything
> other than ***exactly*** the code that you compiled and tested, so you
> aren't excused from having to re-compile and re-test the code 
> with the +1 = +2 modification applied to it, and at that point 
> you may as well re-generate the diff.

Per Dave's advice, here is the regenerated patch (re-compiled 
and re-tested code) for cygstart.

--- ../cygutils-1.2.6/src/cygstart/cygstart.c	2002-03-16 00:49:44.000000000 -0500
+++ src/cygstart/cygstart.c	2005-03-03 10:04:04.097500000 -0500
@@ -340,14 +340,18 @@ int main(int argc, const char **argv)
 
     /* Retrieve any arguments */
     if (rest && *rest) {
-        if ((args = (char *) malloc(MAX_PATH+1)) == NULL) {
+        if ((args = (char *) malloc(strlen(*rest)+1)) == NULL) {
             fprintf(stderr, "%s: memory allocation error\n", argv[0]);
             exit(1);
-        }
-        strncpy(args, *rest, MAX_PATH);
+        }	 
+        strcpy(args, *rest);
         while (rest++ && *rest) {
-            strncat(args, " ", MAX_PATH-strlen(args));
-            strncat(args, *rest, MAX_PATH-strlen(args));
+            if ((args = (char *) realloc(args, strlen(args)+strlen(*rest)+2)) == NULL) {
+                fprintf(stderr, "%s: memory allocation error\n", argv[0]);
+                exit(1);
+            }		
+            strcat(args, " ");
+            strcat(args, *rest);
         }
     }
 
@@ -359,7 +363,7 @@ int main(int argc, const char **argv)
     if (action)
         free(action);
     if (args)
-        free(workDir);
+        free(args);
     if (workDir)
         free(workDir);
     if (file)

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019