1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

removed setenv(), replaced with smbw_setenv()

This commit is contained in:
Andrew Tridgell
-
parent facd8d74e0
commit 72bce217ef
6 changed files with 29 additions and 26 deletions

View File

@ -293,20 +293,3 @@ char *rep_inet_ntoa(struct in_addr ip)
}
#endif
#ifndef HAVE_SETENV
/*****************************************************************
set an env variable - some systems don't have this
*****************************************************************/
int setenv(const char *name, const char *value, int overwrite)
{
pstring s;
if (!overwrite && getenv(name)) return 0;
slprintf(s,sizeof(s)-1,"%s=%s", name, value);
return putenv(s);
}
#endif

View File

@ -1,3 +1,8 @@
*.po
*.po32
kernel_stat.h
smbsh
tst
tst.c
wrapper.h
xstat.c

View File

@ -56,7 +56,7 @@ void smbw_setup_shared(void)
slprintf(s,sizeof(s)-1,"%d", shared_fd);
setenv("SMBW_HANDLE", s, 1);
smbw_setenv("SMBW_HANDLE", s);
return;
@ -177,3 +177,17 @@ void smbw_setshared(const char *name, const char *val)
unlockit();
}
/*****************************************************************
set an env variable - some systems don't have this
*****************************************************************/
int smbw_setenv(const char *name, const char *value)
{
pstring s;
slprintf(s,sizeof(s)-1,"%s=%s", name, value);
return putenv(s);
}

View File

@ -89,28 +89,28 @@ int main(int argc, char *argv[])
smbw_setshared("PASSWORD", p);
}
setenv("PS1", "smbsh$ ", 1);
smbw_setenv("PS1", "smbsh$ ");
sys_getwd(line);
setenv("PWD", line, 1);
smbw_setenv("PWD", line);
slprintf(line,sizeof(line)-1,"%s/smbwrapper.so", libd);
setenv("LD_PRELOAD", line, 1);
smbw_setenv("LD_PRELOAD", line);
slprintf(line,sizeof(line)-1,"%s/smbwrapper.32.so", libd);
if (file_exist(line, NULL)) {
slprintf(line,sizeof(line)-1,"%s/smbwrapper.32.so:DEFAULT", libd);
setenv("_RLD_LIST", line, 1);
smbw_setenv("_RLD_LIST", line);
slprintf(line,sizeof(line)-1,"%s/smbwrapper.so:DEFAULT", libd);
setenv("_RLD32_LIST", line, 1);
smbw_setenv("_RLD32_LIST", line);
} else {
slprintf(line,sizeof(line)-1,"%s/smbwrapper.so:DEFAULT", libd);
setenv("_RLD_LIST", line, 1);
smbw_setenv("_RLD_LIST", line);
}
execl("/bin/sh","sh",NULL);
execl("/bin/sh","smbsh",NULL);
printf("launch failed!\n");
return 1;
}

View File

@ -38,6 +38,7 @@ int smbw_busy=0;
/* needs to be here because of dumb include files on some systems */
int creat_bits = O_WRONLY|O_CREAT|O_TRUNC;
/*****************************************************
initialise structures
*******************************************************/

View File

@ -415,7 +415,7 @@ int smbw_chdir(const char *name)
DEBUG(4,("set SMBW_CWD to %s\n", cwd));
pstrcpy(smbw_cwd, cwd);
if (setenv(SMBW_PWD_ENV, smbw_cwd, 1)) {
if (smbw_setenv(SMBW_PWD_ENV, smbw_cwd)) {
DEBUG(4,("setenv failed\n"));
}