httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@nueva.pvt.k12.ca.us>
Subject Re: For 1.1
Date Sun, 26 May 1996 18:23:21 GMT
On Sun, 26 May 1996, Ben Laurie wrote:

> +1 from me ... but you need to fix the bug in pstrndup, first ... you forgot
> to NUL-terminate the result...

That's right... I'd forgotten that strncpy doesn't do that for
you. How about:

char *pstrndup(struct pool *a, const char *s, int n)
{
  char *res;
  if (s == NULL) return NULL;
  res = palloc (a, n + 1);
  strncpy (res, s, n);
  res[n] = '\0';
  return res;
}

-- 
________________________________________________________________________
Alexei Kosut <akosut@nueva.pvt.k12.ca.us>      The Apache HTTP Server
URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/
 
      "War does not determine who is right, only who is left."



Mime
View raw message