[BusyBox] Patch to add quiet flag to mount/umount

Bill C. Riemers docbill+busybox at freeshell.org
Sat Jul 3 14:41:58 UTC 2004


> Something like this?
>
> +#ifdef CONFIG_FEATURE_SHUT_UP
> + close(0);
> + close(1);
> + close(2);
> + open("/dev/null");
> + dup(0);
> + dup(0);
> +#endif

I do not understand the desire to call the open function with only one
argument.  Perhaps you are just leaving out details because this is an
example?  open() requires at least two arguments, in most cases three
arguments.  Any argument you don't specify will be essentially uninitialized
memory, which is usually zero, but could be anything.

That aside, yes, this would work quite well for the mount command.  You
could even abbreviate it more as:

close(0);
dup2(open("/dev/null",O_RDWR,0666),1);
dup2(0,2);

But I'm not sure in general it is desirable to replace stdin, stdout, and
stderr with a -q options.  In most cases it is just one or two of the
streams that really needs to be redirected.  I also doubt it is desirable to
make it a compile time option in this manner.  Better would be a global
function call, but for only three lines, it is likely smaller code would
result by placing the code inline where needed...

                                           Bill





More information about the busybox mailing list