This is the mail archive of the cygwin-patches@cygwin.com 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: help/version patches




> -----Original Message-----
> From: Joshua Daniel Franklin [mailto:joshuadfranklin@yahoo.com] 

It's not - strace is manually entered version info. 
 
> Anyway here is a patch for cygcheck that I think does the 
> right thing. Somebody want to take a look?

+const char *revision="$Revision: 1.22 $";

This is suspect: The revision string can look like $Revision:$ in some circumstances - see man co again - which is why I had "$Revision: $ " - note the space after the second $ sign.

Likewise, the 
+  /* Get version number out of the autogenerated revision string  */
+  (void *) version = malloc(sizeof(revision));
+  strcpy(version, revision+11);
+  version[strlen(version)-1]= 0;

Could be more robustly done as 
+  version = (char *) malloc(sizeof(revision));
+  strcpy(version, revision+11);
+  {
+    char *temp=version + strlen (version);
+    while (isspace(--temp) && temp >= version);
+    temp[1]='\0';
+  }

Which will munch an arbitrary amount of whitespace.

Rob


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