mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix bugs related to 'uname -d' in the 'uname' builtin (#251)
This commit fixes a bug in the ksh uname builtin's -d option that could change the output of -o (I was only able to reproduce this on Linux): $ builtin uname $ uname -o GNU/Linux $ uname -d (none) $ uname -o (none) I identified this patch from ksh2020 as a fix for this bug: <https://github.com/att/ast/pull/1187> The linked patch was meant to fix a crash in 'uname -d', although I've had no luck reproducing it: <https://github.com/att/ast/issues/1184> src/lib/libcmd/uname.c: - Pass correct buffer to getdomainname() while executing uname -d. src/cmd/ksh93/tests/builtins.sh: - Add a regression test for the reported 'uname -d' crash. - Add a regression test for the output of 'uname -o' after 'uname -d'. - To handle potential crashes when running the regression tests in older versions of ksh, fork the command substitutions that run 'uname -d'.
This commit is contained in:
parent
ca2443b58c
commit
56913f8c2a
4 changed files with 30 additions and 2 deletions
|
@ -493,11 +493,14 @@ b_uname(int argc, char** argv, Shbltin_t* context)
|
|||
if (flags & OPT_domain)
|
||||
{
|
||||
if (!*(s = astconf("SRPC_DOMAIN", NiL, NiL)))
|
||||
{
|
||||
#if _lib_getdomainname
|
||||
getdomainname(s, sizeof(buf));
|
||||
getdomainname(buf, sizeof(buf));
|
||||
s = buf;
|
||||
#else
|
||||
/*NOP*/;
|
||||
#endif
|
||||
}
|
||||
output(OPT_domain, s, "domain");
|
||||
}
|
||||
#if _mem_m_type_utsname
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue