]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/main.c
Import CUPS 1.4svn-r7153.
[thirdparty/cups.git] / scheduler / main.c
index f3836b785ed00d6083a1748accc702bfe9cc976f..5d51538b20f5bbc1f05d5e0008fd8738ea356014 100644 (file)
@@ -149,6 +149,8 @@ main(int  argc,                             /* I - Number of command-line args */
 #ifdef __APPLE__
   int                  run_as_child = 0;
                                        /* Needed for Mac OS X fork/exec */
+#else
+  time_t               netif_time = 0; /* Time since last network update */
 #endif /* __APPLE__ */
 #if HAVE_LAUNCHD
   int                  launchd_idle_exit;
@@ -394,6 +396,14 @@ main(int  argc,                            /* I - Number of command-line args */
 
     for (i = 0; i < limit.rlim_cur && i < 1024; i ++)
       close(i);
+
+   /*
+    * Redirect stdin/out/err to /dev/null...
+    */
+
+    open("/dev/null", O_RDONLY);
+    open("/dev/null", O_WRONLY);
+    open("/dev/null", O_WRONLY);
 #endif /* DEBUG */
   }
 
@@ -840,6 +850,18 @@ main(int  argc,                            /* I - Number of command-line args */
 
     current_time = time(NULL);
 
+#ifndef __APPLE__
+   /*
+    * Update the network interfaces once a minute...
+    */
+
+    if ((current_time - netif_time) >= 60)
+    {
+      netif_time  = current_time;
+      NetIFUpdate = 1;
+    }
+#endif /* !__APPLE__ */
+
 #if HAVE_LAUNCHD
    /*
     * If no other work was scheduled and we're being controlled by launchd