This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: cygstart patch


> 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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]