Or it should check if the process with $core_pid PID is actually a descendant of /bin/rpm, not just any /var/tmp/rpm-tmp.* script is running at the same time. Something like:
```bash
in_rpm=false
pid="$core_pid"
while [ "$pid" -ne 1 ]; do
  if [ "`readlink \"/proc/$pid/exe\"`" = /bin/rpm ]; then
    in_rpm=true
    break
  fi
  pid="`grep '^PPid:' \"/proc/$pid/status\" | sed 's/^PPid:\t//'`"
done
```
(WARNING: not tested!)