On Saturday 23 June 2007, Tito wrote:
> On Saturday 23 June 2007 22:11:53 Tito wrote:
> > On Saturday 23 June 2007 20:10:39 Bernhard Fischer wrote:
> > > On Sat, Jun 23, 2007 at 01:31:19PM -0400, Mike Frysinger wrote:
> > > >On Saturday 23 June 2007, Mike Frysinger wrote:
> > > >> +int xioctl(int fd, int request, unsigned long arg)
> > > >> +{
> > > >> +       int ret = ioctl(fd, request, arg);
> > > >> +       if (ret != 0)
> > > >> +               bb_perror_msg_and_die("ioctl");
> > > >> +       return ret;
> > > >> +}
> > > >
> > > >actually now that i think about it, considering the usage here (people
> > > > usually only care if it fails, they dont want to read the return
> > > > value), we probably can do:
> > > >void xioctl(...)
> > >
> > > Sounds ok to me. I had a patch which did this but did not apply it (and
> > > forgot to ask..) since i though that discarding the information about
> > > which ioctl it was that failed would not be well received, back then.
> > >
> > > Let's hear what vda says, i'd say fore! :)
> > > _______________________________________________
> > > busybox mailing list
> > > [email protected]
> > > http://busybox.net/cgi-bin/mailman/listinfo/busybox
> >
> > Hi,
> > in hdparm.c we already have:
> >
> > /* Busybox messages and functions */
> > static int bb_ioctl(int fd, int request, void *argp, const char *string)
> > {
> >     int e = ioctl(fd, request, argp);
> >     if (e && string)
> >             bb_perror_msg(" %s", string);
> >     return e;
> > }
> >
> > so that we can pass also an error message if needed, maybe this could be
> > also
> >
> > static int bb_ioctl(int fd, int request, void *argp, ...)
> > {
> >     va_list p;
> >     char *string;
> >     va_start(p, request);
> >     string = va_arg(va_list p,  (char *));
> >
> >     int e = ioctl(fd, request, argp);
> >     if (e && string)
> >             bb_perror_msg(" %s", string);
> >     va_end(p);
> >     return e;
> > }
> >
> > untested, just an idea.
> >
> > Ciao,
> > Tito
>
> or better:
>
> static void xioctl(int fd, int request, void *argp, ...)
>  {
>       va_list p;
>       char *string;
>       va_start(p, argp);
>       string = va_arg(va_list p,  (char *));
>
>       int e = ioctl(fd, request, argp);
>       if (e)
>               bb_perror_msg_and_die(" %s", (string) ? string : "ioctl");
>       va_end(p);
>   }

i saw the hdparm code, but that's the only case i saw where the fail was 
conditional, so i'm not sure hdparm is worth folding in
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to