troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
632 stars 63 forks source link

Ensure all filesystems listed in /proc/mounts are unmounted #203

Closed liuming50 closed 3 years ago

liuming50 commented 3 years ago

The iterator function getmntent() is not stable. It may skip entries if the contents of the iterated file changes, which is the case with /proc/mounts when filesystems are unmounted. As a result, some filesystems were never unmounted.

To fix this, iteratation is now restarted after every sucessful unmount.

Signed-off-by: Robert Andersson robert.m.andersson@atlascopco.com Signed-off-by: Ming Liu liu.ming50@gmail.com

troglobit commented 3 years ago

Thanks, well spotted!

For future reference, I've added a follow-up commit that:

  1. Fixes the comment style; from C++ to C style
  2. Drops the extra print(), I'm assuming it was for debug