Right, if you do 3) you don't have to worry very much about 1).
For the record, 1) is easily doable on Linux by comparing
/proc/$pid/root and /proc/self/root, although I don't know whether
Debian would take that since that's non-portable. It would be fine for
Ubuntu though. I suppose a fallback approximation for non-Linux kernels
might be to avoid stopping/restarting the daemon if ischroot exits zero.
Right, if you do 3) you don't have to worry very much about 1).
For the record, 1) is easily doable on Linux by comparing
/proc/$pid/root and /proc/self/root, although I don't know whether
Debian would take that since that's non-portable. It would be fine for
Ubuntu though. I suppose a fallback approximation for non-Linux kernels
might be to avoid stopping/restarting the daemon if ischroot exits zero.