more strict check for [un]setenv() return code

Even if setenv() and unsetenv() function expected to almost never fail
with the current code as per documentation [1], it still makes sense
to check for their return code. This patch updates the call sites
of these functions accordingly.

I also addressed a few warnings that ClangTidy produced
on the updated code.

[1] https://man7.org/linux/man-pages/man3/setenv.3.html

Change-Id: I8257bc4367b3fdf0cda5171de9b39c8d8b87fba9
Reviewed-on: http://gerrit.cloudera.org:8080/20744
Reviewed-by: Abhishek Chennaka <achennaka@cloudera.com>
Reviewed-by: Mahesh Reddy <mreddy@cloudera.com>
Tested-by: Kudu Jenkins
Reviewed-by: Yifan Zhang <chinazhangyifan@163.com>
10 files changed