Skip to contentSkip to conversation

Fix inotify to work not only once

PATCH In review Matthias Schwarzott 2 participants 2 messages Jul 26, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix inotify to work not only once

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

Signature · 1 line
Matthias Schwarzott (zzam)
udevd.c +1 -1
index 69572c6..8f56de6 100644
@@ -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;

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 12 lines · Matthias Schwarzott

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);
(quoted diff) +1 -1
-                               if (!buf) {
+                               if (buf != NULL) {
                                        err("error getting buffer for inotify, disable watching");
Quoted 2 lines

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel