Open
Description
Now that fwupd
and other tools potentially also mount and unmount /boot
, we need to assure that, while manipulations are made, the filesystem isn't unmounted by someone else.
The easiest and cleanest solution @fenrus75 and me came up with at lunch is to use opendir()
and keep the DIR
entry open as long as operations are proceeding.
The reason we don't want to lock a file is because we don't want to create lockfiles for no reason.
opendir()
will prevent unmounting. We can lazy unmount as well to further make things more reliable.
DIR *d = opendir("/boot/loader");
//do work
closedir(d);