honeyd/setenv.c

Tue, 28 Aug 2012 18:36:35 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:36:35 +0200
changeset 579
6b18bb69901e
permissions
-rw-r--r--

Correct the paths of patched scripts, refine password generation,
mitigate fdatasync(2) detection problems, correct dependencies, remove
outdated autoconf components, correct conf file paths and attributes,
complete and correct log file rotation handing, and note warnings
useful for diagnosing builds.

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