When comparing two binaries with abi{pkg}diff, if $HOME is not set, we
segfault at some places because we don't expect that. I ran "make
check" after doing "unset HOME" to help me catch most of those places.
This patch updates the code to handle that case.
* src/abg-tools-utils.cc
(get_default_user_suppression_file_path): Handle the case where
the HOME environment variable is not set.
* tools/abipkgdiff.cc (package::extracted_packages_parent_dir):
Likewise. When $HOME is empty set then use $TMPDIR. If it's
empty too then use "/tmp".
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
if (s == NULL)
{
s = getenv("HOME");
+ if (s == NULL)
+ return "";
default_user_suppr_path = s;
if (default_user_suppr_path.empty())
default_user_suppr_path = "~";
p = cachedir;
else
{
- p = getenv("HOME");
+ const char* s = getenv("HOME");
+ if (s != NULL)
+ p = s;
if (p.empty())
- p = "~";
+ {
+ s = getenv("TMPDIR");
+ if (s != NULL)
+ p = s;
+ else
+ p = "/tmp";
+ }
p += "/.cache/libabigail";
}