apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kfo...@locus.apache.org
Subject cvs commit: apr/misc/unix getopt.c
Date Sat, 25 Nov 2000 05:52:18 GMT
kfogel      00/11/24 21:52:17

  Modified:    misc/unix getopt.c
  Log:
  (apr_initopt): null-terminate the copy of argv.  Again, from Greg
  Hudson <ghudson@mit.edu>.
  
  Revision  Changes    Path
  1.27      +2 -1      apr/misc/unix/getopt.c
  
  Index: getopt.c
  ===================================================================
  RCS file: /home/cvs/apr/misc/unix/getopt.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- getopt.c	2000/11/25 05:14:59	1.26
  +++ getopt.c	2000/11/25 05:52:17	1.27
  @@ -63,9 +63,10 @@
          that's the primary purpose of this function.  But people might
          want to use this function with arrays other than the main argv,
          and we shouldn't touch the caller's data.  So we copy. */
  -    (*os)->argv = apr_palloc(cont, argc * sizeof(const char *));
  +    (*os)->argv = apr_palloc(cont, (argc + 1) * sizeof(const char *));
       for (i = 0; i < argc; i++)
   	(*os)->argv[i] = argv[i];
  +    (*os)->argv[argc] = NULL;
   
       (*os)->interleave = 0;
       (*os)->ind = 1;
  
  
  

Mime
View raw message