[BusyBox 0003514]: runsvdir always warns it cannot read the directory

bugs at busybox.net bugs at busybox.net
Fri May 30 23:57:48 PDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=3514 
====================================================================== 
Reported By:                mnemoc
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   3514
Category:                   Other
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             05-29-2008 11:58 PDT
Last Modified:              05-30-2008 23:57 PDT
====================================================================== 
Summary:                    runsvdir always warns it cannot read the directory
Description: 
the logic of runsvdir assumes just readdir() may set errno, and relies on
that to decide when to warn.

but runsv() calls vfork() which is always setting errno=2 when pid>0, so
one always gets:

runsvdir: /var/service: warning: cannot read directory /var/service

I know `runsvdir` is not guilty, but I didn't know what to do on vfork()'s
code to try to fix it
====================================================================== 

---------------------------------------------------------------------- 
 vda - 05-30-08 23:57  
---------------------------------------------------------------------- 
This looks like better fix, no?

--- busybox.1/runit/runsvdir.c  2008-05-28 14:00:33.000000000 +0200
+++ busybox.2/runit/runsvdir.c  2008-05-31 08:54:05.000000000 +0200
@@ -141,8 +141,12 @@ static void runsvdir(void)
        }
        for (i = 0; i < svnum; i++)
                sv[i].isgone = 1;
-       errno = 0;
-       while ((d = readdir(dir))) {
+
+       while (1) {
+               errno = 0;
+               d = readdir(dir);
+               if (!d)
+                       break;
                if (d->d_name[0] == '.')
                        continue;
                if (stat(d->d_name, &s) == -1) { 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
05-29-08 11:58  mnemoc         New Issue                                    
05-29-08 11:58  mnemoc         Status                   new => assigned     
05-29-08 11:58  mnemoc         Assigned To               => BusyBox         
05-29-08 11:58  mnemoc         File Added: pkg_busybox.patch                    
05-30-08 23:57  vda            Note Added: 0007914                          
======================================================================



More information about the busybox-cvs mailing list