[BusyBox] [PATCH] devfsd - last minute fix n2

Allen Chan allen at developers.alyz.com
Sat Nov 20 04:23:11 UTC 2004


The format string passed to bb_verror_msg contains "%m" inside, and it 
appears that "%m" is always converted to the output of 
strerror(errno) by the printf family of functions, even though I 
cannot find any documentation that says that this is the proper 
behavior.  I did find this note via google:

 http://sources.redhat.com/ml/newlib/2004/msg00485.html

Try this test program and you'll see what I mean:

    #include <stdio.h>
    #include <unistd.h>

    main()
    {
        access("intentional-non-existing-file",F_OK);
        printf("hello world. %m\n");
    }

In your test example, are you sure that /dev/log does not exist?  I 
find that /dev/log will exist if I ever run syslogd/klogd, even if I 
kill the processes later.  The only way for me not to have /dev/log 
is to never have started syslogd/klogd.  Also, are you sure you have 
CONFIG_DEVFSD_VERBOSE=y set,  because if it runs correctly 
and /dev/log does not exist, it should print out two lines on the 
console, not one:

devfsd v1.3.25  started for /dev
devfsd: read config file: /etc/devfsd.conf: Success


On Friday 19 November 2004 09:03 pm, Tito wrote:
> Hi Allen,
>
> On Friday 19 November 2004 OO:24, Allen Chan wrote:
> > This revised patch does not fix the original problem.  This is
> > because the error message is generated during the bb_verror_msg()
> > call inside
>
> extern void bb_verror_msg(const char *s, va_list p)
> {
>  fflush(stdout);
>  fprintf(stderr, "%s: ", bb_applet_name);
>  vfprintf(stderr, s, p);
> }
>
> This is strange as the man pages don't report errno setting for
> fflush, fprintf and vfprintf. The only call in msg_logger() that
> can change errno seems to be access(). So if you restore or zero
> errno after access is called or at the end of the msg_logger your
> problem should be solved or am i missing something important here?
>
> > msg_logger(), so that errno must be restored before
> > bb_verror_msg() is called in order to not generate the false
> > error message.
>
> I'm running patched busybox devfsd (renamed to /sbin/devfsd) in
> this moment, without syslogd and klogd and without /dev/log and it
> works for me.
>
>   PID TTY          TIME CMD
>     1 ?        00:00:01 init
>     2 ?        00:00:00 ksoftirqd/0
>     3 ?        00:00:00 events/0
>     4 ?        00:00:00 khelper
>    20 ?        00:00:00 kblockd/0
>    40 ?        00:00:00 kapmd
>    42 ?        00:00:00 pdflush
>    43 ?        00:00:00 pdflush
>    45 ?        00:00:00 aio/0
>    44 ?        00:00:00 kswapd0
>   118 ?        00:00:00 kseriod
>   379 ?        00:00:00 kjournald
>   578 ?        00:00:00 minilogd
>   635 ?        00:00:00 devfsd
>   736 ?        00:00:00 khubd
>  1123 ?        00:00:00 scsi_eh_0
>  1124 ?        00:00:00 usb-storage
>  1200 ?        00:00:00 scsi_eh_1
>  1201 ?        00:00:00 usb-storage
>  1332 ?        00:00:00 kjournald
>  1333 ?        00:00:00 kjournald
>  1343 ?        00:00:00 kjournald
>  1344 ?        00:00:00 kjournald
>  1345 ?        00:00:00 kjournald
>  1346 ?        00:00:00 kjournald
>  1347 ?        00:00:00 kjournald
>  3785 ?        00:00:00 xfs
>  3809 ?        00:00:00 dbus-daemon-1
>  3834 ?        00:00:00 irattach
>  3843 ?        00:00:00 kIrDAd
>  3869 ?        00:00:00 xinetd
>  3925 ?        00:00:00 cupsd
>  4165 ?        00:00:00 master
>  4170 ?        00:00:00 pickup
>  4171 ?        00:00:00 qmgr
>  4172 ?        00:00:00 tlsmgr
>  4463 ?        00:00:00 miniserv.pl
>  4554 ?        00:00:00 login
>  4562 tty2     00:00:00 mingetty
>  4563 tty3     00:00:00 mingetty
>  4564 tty4     00:00:00 mingetty
>  4565 tty5     00:00:00 mingetty
>  4566 tty6     00:00:00 mingetty
>  4793 tty1     00:00:00 bash
>  4859 tty1     00:00:00 ps
>
> devfsd /dev
> devfsd v1.3.25  started for /dev
>
>
> Ciao,
> Tito
> _______________________________________________
> busybox mailing list
> busybox at mail.busybox.net
> http://busybox.net/mailman/listinfo/busybox

-- 
Allen Chan
allen at developers.alyz.com
http://www.alyz.com



More information about the busybox mailing list