Received: (from majordom@localhost) by hyperreal.org (8.8.5/8.8.5) id WAA01017; Wed, 23 Jul 1997 22:42:05 -0700 (PDT) Received: from sierra.zyzzyva.com (ppp0-sierra.zyzzyva.com [208.214.59.46]) by hyperreal.org (8.8.5/8.8.5) with ESMTP id WAA00926 for ; Wed, 23 Jul 1997 22:41:52 -0700 (PDT) Received: from twinlark.arctic.org (twinlark.arctic.org [204.62.130.91]) by sierra.zyzzyva.com (8.8.5/8.8.2) with SMTP id AAA16133 for ; Thu, 24 Jul 1997 00:21:28 -0500 (CDT) Received: (qmail 17202 invoked by uid 500); 24 Jul 1997 05:21:54 -0000 Date: Wed, 23 Jul 1997 22:21:54 -0700 (PDT) From: Dean Gaudet To: new-httpd@apache.org Subject: Re: [PATCH] Enable sortable columns in FancyIndexed directories In-Reply-To: <97072310424897@decus.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org I haven't tested this, but it looks fine except: On Wed, 23 Jul 1997, Rodent of Unusual Size wrote: > +static void emit_link(request_rec *r, char *anchor, char fname, char curkey, > + char curdirection) > +{ > + char *qvalue = "?.=."; > + int reverse; > + > + qvalue[1] = fname; > + reverse = ((curkey == fname) && (curdirection == D_ASCENDING)); > + qvalue[3] = reverse ? D_DESCENDING : D_ASCENDING; > + rvputs (r, "", anchor, "", NULL); > +} qvalue points to a const char *... which most compilers don't warn about because it's such a common problem. Your code here isn't thread safe. It should be something like: char qvalue[5]; qvalue[0] = '?'; qvalue[1] = fname; .... qvalue[4] = 0; /* just to annoy Marc */ If it were a really long string you could use snprintf to fill it in, or whatever... you just need to be sure you're not modifying a statically allocated string. gcc -Wwrite-strings warns about this sort of thing ... but is really hard to use against apache at the moment. It's probably worthwhile for us to take this step at some point ... there could be subtle threading bugs like this above. Dean