scripts: ensure correct tempfile handling used throughout
commitfaebf41be59418c7d829fd054048ff27cb5cd946
authorNathan Scott <nathans@redhat.com>
Wed, 5 Oct 2016 00:37:46 +0000 (5 11:37 +1100)
committerNathan Scott <nathans@redhat.com>
Wed, 5 Oct 2016 00:37:46 +0000 (5 11:37 +1100)
tree6ddfafe594c137762bc066bab814e88c31685880
parent9334fe790c83c2bc2c42a97bd7189fe395414717
scripts: ensure correct tempfile handling used throughout

Auditing recent SElinux failure logs came across an accidental
regression from recent changes, where we've started using /tmp
directly in _get_pids_by_name rather than the tmpfile handling
of the calling script.

This is further complicated by pmdaproc.sh having some special
tmpfile handling ($__tmp instead of $tmp) which also conflicts
accidentally with same-named variable use in _get_pids_by_name.

So, this change makes _get_pids_by_name use the $tmp scheme of
the calling script.  It also updates pmdaproc.sh to share this
same scheme (keeping $__tmp for Install/Remove back-compat).

The PMDA(3) man page is updated to reflect this, and to correct
the discussion of $__tmp (which was a directory even before the
change being made here, so some wording there was NQR).

It would be good to switch pcp/qa over to using mktemp rather
than its own scheme, but thats a much larger change.  So, I've
put a little note in _get_pids_by_name to this affect, and we
allow it to continue to be called from QA (with a file prefix,
rather than a directory prefix for tmpfiles, IOW).
man/man3/pmda.3
src/include/pcp.env
src/pmcd/pmdaproc.sh