mFusePid should be cleared after waitpid successfully

When waitpid is successful, we need to reset mFusePid
since mFusePid will be killed again unnecessarily
in doUnmount() if we don't reset mFusePid.

As a result, it will kill another unrelated process
in the case of pids wrap around.

Test: reboot
Fixes: 1d79d10 ("Check if sdcard daemon exited.")

Change-Id: Icb422d5c81621f9f6b9f4b1218e94b1d89172763
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
gugelfrei
Gao Xiang 7 years ago
parent 56b0e8c1df
commit 9aec7a2fb6

@ -105,7 +105,8 @@ status_t EmulatedVolume::doMount() {
usleep(50000); // 50ms
}
/* sdcardfs will have exited already. FUSE will still be running */
TEMP_FAILURE_RETRY(waitpid(mFusePid, nullptr, WNOHANG));
if (TEMP_FAILURE_RETRY(waitpid(mFusePid, nullptr, WNOHANG)) == mFusePid)
mFusePid = 0;
return OK;
}

@ -191,7 +191,8 @@ status_t PublicVolume::doMount() {
usleep(50000); // 50ms
}
/* sdcardfs will have exited already. FUSE will still be running */
TEMP_FAILURE_RETRY(waitpid(mFusePid, nullptr, WNOHANG));
if (TEMP_FAILURE_RETRY(waitpid(mFusePid, nullptr, WNOHANG)) == mFusePid)
mFusePid = 0;
return OK;
}

Loading…
Cancel
Save