Skip to content

Commit fde59b3

Browse files
committed
mountinfo: don't kill openrc on do_unmount
1 parent 0585c2c commit fde59b3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/mountinfo/mountinfo.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ static void fuser_run(struct run_queue *rp, const char *fuser_opt)
484484
static int fuser_decide(struct run_queue *rp,
485485
const char *fuser_opt, const char *fuser_kill_prefix)
486486
{
487+
static bool has_rc_pid = false;
488+
static char *rc_pid;
487489
char buf[1<<12];
488490
char selfpid[64];
489491
int read_maybe_truncated;
@@ -505,7 +507,12 @@ static int fuser_decide(struct run_queue *rp,
505507
buf[n+2] = '\0';
506508
snprintf(selfpid, sizeof selfpid, " %lld ", (long long)getpid());
507509

508-
if (strstr(buf, selfpid)) {
510+
if (!has_rc_pid) {
511+
rc_pid = getenv("RC_PID");
512+
has_rc_pid = true;
513+
}
514+
515+
if (strstr(buf, selfpid) || (rc_pid && strstr(buf, rc_pid))) {
509516
/* lets not kill ourselves */
510517
eerror("Unmounting %s failed because we are using it", rp->mntpath);
511518
return -1;

0 commit comments

Comments
 (0)