]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commit
Fix HostinfoGetCmdOutput to return NULL on failure
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)
commit9367d3e3cf8819b198dd52cd4e1f19872efcfefe
tree094a1dd957da5e21fd9e7994097ca15320bfe87d
parent15626c9d3a81d4d629902504ed7fd21d04f5e4b6
Fix HostinfoGetCmdOutput to return NULL on failure

HostinfoGetCmdOutput unconditionally calls DynBuf_DetachString
along its success path.  DynBuf_DetachString never returns NULL,
so that broke callers expecting a NULL return value if the command
had no output (which can happen if HostinfoGetCmdOutput attempts to
run a non-existent executable; note that this does not trigger any
of the failure paths).

Restore the old code that checked if the DynBuf is non-empty
before retrieving its contents.

Bonus:
* Fix incorrect documentation to Posix_Popen.
* Adjust the StdIO_ReadNextLine documentation to clarify its behavior.
open-vm-tools/lib/misc/hostinfoPosix.c
open-vm-tools/lib/misc/posixPosix.c
open-vm-tools/lib/misc/vmstdio.c