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

Accumulated fixes for minor issues (#442)

This commit applies various accumulated bugfixes:

- Applied some fixes for compiler warnings based off of the
  following pull requests (with whitespace changes excluded to
  avoid inflating the size of the diff):

  https://github.com/att/ast/pull/281
  https://github.com/att/ast/pull/283
  https://github.com/att/ast/pull/303
  https://github.com/att/ast/pull/304

- clone_type(): Two separate variables in this function share the
  same name. A bugfix from ksh93v- 2013-05-24 was backported to
  avoid conflict issues.

- Backported a minor error message improvement from ksh2020 for
  when the user attempts to run too many coprocesses.

- Backported a ksh2020 bugfix for a file descriptor leak:
  58bc8b56

- Backported ksh2020 bugfixes for unused variable and pointless
  assignment lint warnings:
  47650fe0
  df209c0d
  5e417b00

- Applied a few minor improvements to libast from graphviz:
  e7c03541
  969a7cde

- dtmemory(): Mark unused parameters with NOT_USED(). Based on:
  6ac3ad99

- Applied a few documentation/comment tweaks for the NEWS file,
  printf -v and spawnveg.

- Added a missing regression test for using the rm builtin's -f
  option without additional arguments (this was fixed in
  ksh93u+ 2012-02-14).
This commit is contained in:
Johnothan King 2022-01-30 12:09:14 -08:00 committed by Martijn Dekker
parent e3a1dda93a
commit ad9f9ff13e
23 changed files with 78 additions and 59 deletions

View file

@ -2,7 +2,7 @@
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
@ -34,6 +34,8 @@ static void* dtmemory(Dt_t* dt, /* dictionary */
size_t size, /* size to obtain */
Dtdisc_t* disc) /* discipline */
{
NOT_USED(dt);
NOT_USED(disc);
if(addr)
{ if(size == 0)
{ free(addr);

View file

@ -94,4 +94,4 @@ cannot make the new process a session leader when using the
.I posix_spawn
API.
.SH "SEE ALSO"
fork(2), posix_spawn(3), exec(2), setpgid(2), setsid(2), spawnve(2)
fork(2), vfork(2), posix_spawn(3), exec(2), setpgid(2), setsid(2), spawnve(2)

View file

@ -2,7 +2,7 @@
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
@ -1111,6 +1111,7 @@ init(register char* s, Optpass_t* p)
}
s = next(s, 0);
if (*s != '[')
{
for (t = s, a = 0; *t; t++)
if (!a && *t == '-')
{
@ -1121,6 +1122,7 @@ init(register char* s, Optpass_t* p)
a++;
else if (*t == ']')
a--;
}
if (!p->version && (t = strchr(s, '(')) && strchr(t, ')') && (state.cp || (state.cp = sfstropen())))
{
/*

View file

@ -2,7 +2,7 @@
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
@ -1351,10 +1351,10 @@ print(Sfio_t* sp, register Lookup_t* look, const char* name, const char* path, i
* return read stream to native getconf utility
*/
#ifdef _pth_getconf_a
static Sfio_t*
nativeconf(Proc_t** pp, const char* operand)
{
#ifdef _pth_getconf
Sfio_t* sp;
char* cmd[3];
long ops[2];
@ -1376,9 +1376,9 @@ nativeconf(Proc_t** pp, const char* operand)
}
procclose(*pp);
}
#endif
return 0;
}
#endif
/*
* value==0 gets value for name

View file

@ -2,7 +2,7 @@
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
@ -59,7 +59,9 @@ static char* Version = "\n@(#)$Id: sfio (AT&T Labs - Research) 2009-09-15 $\0\n"
#include <signal.h>
typedef void(* Sfsignal_f)(int);
#endif
#ifdef SIGPIPE
static int _Sfsigp = 0; /* # of streams needing SIGPIPE protection */
#endif
/* done at exiting time */
static void _sfcleanup(void)

View file

@ -2,7 +2,7 @@
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
@ -62,9 +62,8 @@ static void execute(const char* argcmd)
goto do_interp;
/* try to construct argv */
if(!(cmd = (char*)malloc(strlen(argcmd)+1)) )
if(!(cmd = strdup(argcmd)) )
goto do_interp;
strcpy(cmd,argcmd);
if(!(argv = (char**)malloc(16*sizeof(char*))) )
goto do_interp;
for(n = 0, s = cmd;; )

View file

@ -2,7 +2,7 @@
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
@ -159,11 +159,10 @@ char** _sfgetpath(char* path)
}
if(n == 0 || !(dirs = (char**)malloc((n+1)*sizeof(char*))) )
return NIL(char**);
if(!(p = (char*)malloc(strlen(path)+1)) )
if(!(p = strdup(path)) )
{ free(dirs);
return NIL(char**);
}
strcpy(p,path);
for(n = 0;; ++n)
{ while(*p == ':')
++p;
@ -218,12 +217,11 @@ static int _tmpfd(Sfio_t* f)
return -1;
if(!(file = getenv("TMPDIR")) )
file = TMPDFLT;
if(!(Tmppath[0] = (char*)malloc(strlen(file)+1)) )
if(!(Tmppath[0] = strdup(file)) )
{ free(Tmppath);
Tmppath = NIL(char**);
return -1;
}
strcpy(Tmppath[0],file);
Tmppath[1] = NIL(char*);
}

View file

@ -2,7 +2,7 @@
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
@ -137,7 +137,6 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t)
{
if ((c = *format++) == delimiter)
{
delimiter = 0;
if (sp <= &stack[0])
break;
sp--;

View file

@ -173,7 +173,6 @@ scan(register const char* s, char** e, const char* format, char** f, Time_t t, l
register char* p;
register Tm_t* tm;
const char* b;
char* u;
char* stack[4];
int m;
int hi;
@ -184,6 +183,7 @@ scan(register const char* s, char** e, const char* format, char** f, Time_t t, l
Tm_zone_t* zp;
Tm_t ts;
char* u = 0;
char** sp = &stack[0];
while (isspace(*s))
@ -397,7 +397,7 @@ scan(register const char* s, char** e, const char* format, char** f, Time_t t, l
s = b;
goto again;
case '&':
x = gen(tm, &set);
(void)gen(tm, &set);
x = tmxdate(s, e, t);
if (s == (const char*)*e)
goto next;