tags 511095 patch
thanks

and here's the patch.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
diff -ur sbuild-0.57.7/src/Makefile.am sbuild-0.57.7.new/src/Makefile.am
--- sbuild-0.57.7/src/Makefile.am	2008-08-23 13:52:19.000000000 +0000
+++ sbuild-0.57.7.new/src/Makefile.am	2009-01-07 05:45:51.240721475 +0000
@@ -26,3 +26,5 @@
 
 buildd_mail_wrapper_SOURCES =	\
 	buildd-mail-wrapper.c
+
+buildd_mail_wrapper_LDADD = -lm
diff -ur sbuild-0.57.7/src/buildd-mail-wrapper.c sbuild-0.57.7.new/src/buildd-mail-wrapper.c
--- sbuild-0.57.7/src/buildd-mail-wrapper.c	2008-08-23 13:52:19.000000000 +0000
+++ sbuild-0.57.7.new/src/buildd-mail-wrapper.c	2009-01-07 05:48:39.228654805 +0000
@@ -27,7 +27,6 @@
 #include <errno.h>
 #include <time.h>
 #include <dirent.h>
-#include <sys/sysinfo.h>
 #include <sys/types.h>
 #include <signal.h>
 
@@ -156,10 +155,11 @@
    * mailer-running yet. So, in this case, wait some time and then check for
    * mailer-running again. */
   if (!dir_was_empty) {
-    struct sysinfo info;
+    double load;
     int waittime;
-    sysinfo( &info );
-    waittime = (info.loads[0] >> (SI_LOAD_SHIFT-2))*6 + 20;
+    getloadavg( &load, 1 );
+    waittime = (((int)load) << 2 | (int)(fmod( load, 1 )*4))*6 + 20;
+
     DPRINTF( "dir was not empty, sleeping\nload*4=%d waittime=%d\n",
 	     (waittime-20)/6, waittime );
     sleep( waittime );

Reply via email to