]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libmount: improve monitor to be usable for non-root users
authorKarel Zak <kzak@redhat.com>
Fri, 19 Jun 2015 10:17:45 +0000 (12:17 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 19 Jun 2015 10:30:40 +0000 (12:30 +0200)
commit7dc0f5c90ee9899a1d92de77ad3d8af998198379
treef5dde135d91100e511de6890b6067f23f678d113
parentc893f5e462265b59cd0c27bd38b6355e799a302a
libmount: improve monitor to be usable for non-root users

The current implementation calls mkdir and open(O_CREATE) to
initialize /run/mount/utab.lock before it starts to monitor the file.
Unfortunately it makes the monitor useless for non-root processes
(e.g. systemd --user).

The new implementation adds inotify watch for the last existing
component in the path (/run/mount/utab.lock) and re-initialize
after a change. It makes the monitor robust enough for mkdir/rmdir
when monitor is already active.

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/monitor.c