chiark / gitweb /
[PATCH] correct detection of hotplug.d/ udevsend loop
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Wed, 5 Jan 2005 04:31:42 +0000 (05:31 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:19:09 +0000 (23:19 -0700)
If udevsend is called from the commandline the env may be too
big to fit in our buffer and we tag the message.

udevsend.c

index 05a50facc51600cb5eeb04eed1e3702f279686c4..d86004ba3b9faf735dbc824d38adef22b8a2018c 100644 (file)
@@ -148,10 +148,6 @@ int main(int argc, char *argv[], char *envp[])
 
                key = envp[i];
                keylen = strlen(key);
-               if (bufpos + keylen >= HOTPLUG_BUFFER_SIZE-1) {
-                       dbg("environment buffer too small, probably not called by the kernel");
-                       continue;
-               }
 
                /* prevent loops in the scripts we execute */
                if (strncmp(key, "UDEVD_EVENT=", 12) == 0) {
@@ -159,6 +155,11 @@ int main(int argc, char *argv[], char *envp[])
                        goto exit;
                }
 
+               if (bufpos + keylen >= HOTPLUG_BUFFER_SIZE-1) {
+                       dbg("environment buffer too small, probably not called by the kernel");
+                       continue;
+               }
+
                /* remember the SUBSYSTEM */
                if (strncmp(key, "SUBSYSTEM=", 10) == 0)
                        subsystem = &key[10];