[Drbd-dev] Another small patch for guess_dev_name in user/drbdsetup.c (0.7 branch)

Iustin Pop iustin at google.com
Tue Jan 9 10:37:47 CET 2007


Hi,

guess_dev_name can exit early if the major/minor pair passed in is 0,0
as this is not a real device so we won't find it in /dev. This skips
recursing over /dev and stat-ing every file.

Attached patch fixes this.

Regards,
Iustin Pop
-------------- next part --------------
Index: user/drbdsetup.c
===================================================================
--- user/drbdsetup.c	(revision 2659)
+++ user/drbdsetup.c	(working copy)
@@ -1220,6 +1220,9 @@
   struct stat sb;
   static char dev_name[50];
 
+  if(major==0 && minor==0)
+    return NULL;
+
   device_dir=opendir(dir);
 
   if(!device_dir) goto err_out;


More information about the drbd-dev mailing list