httpd: addEnv() brainstorming

Dirk Clemens develop at cle-mens.de
Mon Sep 5 13:15:36 UTC 2005


Dirk Clemens wrote:

> Here is an other recommendation for addEnv()
>
> static void addEnv(const char *name_before_underline, const char
> *name_after_underline, const char *value) { char buf[50]; // this
> is enough space for all names used in httpd
>
> if ( snprintf(buf,sizeof(buf), "%s%s%s=%s", name_before_underline,
> *name_after_underline ? "_" : "", name_after_underline ) >= 0 )
> setenv(buf, value ? value : "", 1 ); }
>
>
A mistake:
The format string in snprintf must be "%s%s%s"



More information about the busybox mailing list