1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

main.c: Tweak fixargs() (re: cefe087d)

src/cmd/ksh93/sh/main.c: fixargs():
- Erase the entire length of the command arguments buffer (the
  space from argv[0] until environ[0]) so that remnants of longer
  command arguments aren't left in 'ps' output when executing a
  hashbang-ess script with a shorter command line.
- Disable fixargs() on FreeBSD. It has never had any effect on that
  system; apparently it either requires another method to rewrite
  arguments for 'ps' output purposes (which?) or it's not possible.

src/cmd/ksh93/tests/basic.sh:
- Skip the test if running on FreeBSD.
This commit is contained in:
Martijn Dekker 2021-01-10 06:34:49 +00:00
parent e7202832fd
commit 159fb9ee27
2 changed files with 5 additions and 8 deletions

View file

@ -52,7 +52,7 @@
/* These routines are referenced by this module */
static void exfile(Shell_t*, Sfio_t*,int);
static void chkmail(Shell_t *shp, char*);
#if defined(_lib_fork) && !defined(_NEXT_SOURCE)
#if defined(_lib_fork) && !defined(_NEXT_SOURCE) && !defined(__FreeBSD__)
static void fixargs(char**,int);
#else
# define fixargs(a,b)
@ -697,7 +697,7 @@ static void chkmail(Shell_t *shp, char *files)
# define PSTAT 1
#endif
#if defined(_lib_fork) && !defined(_NEXT_SOURCE)
#if defined(_lib_fork) && !defined(_NEXT_SOURCE) && !defined(__FreeBSD__)
/*
* fix up command line for ps command
*
@ -735,9 +735,7 @@ static void fixargs(char **argv, int mode)
if(mode==0)
{
buff = argv[0];
while(cp = *argv++)
command_len += strlen(cp)+1;
command_len -= 1;
command_len = environ[0] - buff - 1;
return;
}
# endif /* PSTAT */