honeyd/setenv.c

Mon, 17 Sep 2012 19:10:10 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 17 Sep 2012 19:10:10 +0200
changeset 689
9fe04d4d4e5a
permissions
-rw-r--r--

Update to new version of vendor software although Oracle fails to deliver.
More specifically, newer db(3) patch revisions exist but Oracle has
removed them from the canonical download server URI for Berkely DB.

michael@574 1
michael@574 2 #ifndef HAVE_SETENV
michael@574 3 #ifdef HAVE_CONFIG_H
michael@574 4 #include "config.h"
michael@574 5 #endif
michael@574 6 #include <sys/types.h>
michael@574 7 #include <stdlib.h>
michael@574 8 #include <string.h>
michael@574 9
michael@574 10 int setenv(const char *kszName, const char *kszValue, int nOverwrite)
michael@574 11 {
michael@574 12 char *szPair = NULL;
michael@574 13
michael@574 14 if (nOverwrite == 0 && getenv(kszName) != 0)
michael@574 15 return 0;
michael@574 16 szPair = malloc(strlen(kszName) + 1 + strlen(kszValue) + 1);
michael@574 17 if (szPair == NULL)
michael@574 18 return -1;
michael@574 19 strcpy(szPair, kszName);
michael@574 20 strcat(szPair, "=");
michael@574 21 strcat(szPair, kszValue);
michael@574 22 putenv(szPair);
michael@574 23 return 0;
michael@574 24 }
michael@574 25 #endif /* !HAVE_SETENV */
michael@574 26

mercurial