Re: Editing /etc/hostname(in Debian) with vim will remove its inotify watch



On Fri, 2010-01-22 at 16:33 +0800, cee1 wrote:
> Hi all,
> 
> 
> It seems editing /etc/hostname with vim,  the original /etc/hostname
> will be removed first, then the inotify watch is also removed. The
> following changes of /etc/hostname are detectable by
> nm-system-settings, unless restart it.
> 
> 
> BTW,  "if (!(evt.mask &
> IN_IGNORED))" (src/system-settings/nm-inotify-helper.c: line 109) will
> be true on the remove event, but evt.mask & IN_DELETE_SELF is not
> true, seems not as described in inotify's man page.

Hmm, I wasn't expecting this sort of thing.  I guess we need to
monitor /etc as well to get events when the file gets added back or
renamed to /etc/hostname.  Any chance you could do a patch for that?
There's some directory monitoring code in
system-settings/plugins/ifcfg-rh/plugin.c that could be adapted for this
(the code in ifcfg-rh monitors /etc/sysconfig/network).

Dan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]