linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix inotify to work not only once
@ 2007-07-26  9:14 Matthias Schwarzott
  2007-07-26 11:03 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Schwarzott @ 2007-07-26  9:14 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

Hi there!

The inotify code in udevd.c contains a bug disabling inotify after first 
modification catch.

The patch entitled "handle dynamic rules created in /dev/.udev/rules.d/" 
contains this:
 				buf = malloc(nbytes);
-				if (!buf) {
+				if (buf != NULL) {
 					err("error getting buffer for inotify, disable watching");

But this makes the code disable inotify if malloc is successful. Shouldnt this 
be buf == NULL, or just the original !buf.
The attached patch fixes this.

Matthias

-- 
Matthias Schwarzott (zzam)

[-- Attachment #2: udev-fix-inotify.diff --]
[-- Type: text/x-diff, Size: 372 bytes --]

diff --git a/udevd.c b/udevd.c
index 69572c6..8f56de6 100644
--- a/udevd.c
+++ b/udevd.c
@@ -1202,7 +1202,7 @@ int main(int argc, char *argv[], char *envp[])
 
 				reload_config = 1;
 				buf = malloc(nbytes);
-				if (buf != NULL) {
+				if (buf == NULL) {
 					err("error getting buffer for inotify, disable watching");
 					close(inotify_fd);
 					inotify_fd = -1;

[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 226 bytes --]

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix inotify to work not only once
  2007-07-26  9:14 [PATCH] Fix inotify to work not only once Matthias Schwarzott
@ 2007-07-26 11:03 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2007-07-26 11:03 UTC (permalink / raw)
  To: linux-hotplug

On 7/26/07, Matthias Schwarzott <zzam@gentoo.org> wrote:
> Hi there!
>
> The inotify code in udevd.c contains a bug disabling inotify after first
> modification catch.
>
> The patch entitled "handle dynamic rules created in /dev/.udev/rules.d/"
> contains this:
>                                 buf = malloc(nbytes);
> -                               if (!buf) {
> +                               if (buf != NULL) {
>                                         err("error getting buffer for inotify, disable watching");
>
> But this makes the code disable inotify if malloc is successful. Shouldnt this
> be buf = NULL, or just the original !buf.

Yeah, silly bug. Applied.

Thanks a lot,
Kay

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-26 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-26  9:14 [PATCH] Fix inotify to work not only once Matthias Schwarzott
2007-07-26 11:03 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).