[BusyBox] patch: libbb/or_die.c
Vladimir N. Oleynik
dzo at simtreas.ru
Sun Mar 18 16:27:40 UTC 2001
Evin,
> Fairly often the busybox source has things like:
>
> fd = open("some file", O_RDONLY);
> if(fd < 0)
> perror_msg_and_die("open some file");
> if(ioctl(fd, IOSOMECTL, )) < 0)
> perror_msg_and_die("ioctl IOSOMECTL");
>
> Here's a patch which converts this to:
>
> fd = open_or_die("some file", O_RDONLY);
I think, this interesting idea.
> ioctl_or_die(fd, IOSOMECTL, );
Oh, I think - this not best.
But, see variant:
ioctl_or_die(int fd, int cmd, void *arg, const char *fmt, ...)
After, we can convert equivalent run, and best view error in previous texts.
> This saves a few bytes and maybe even makes the error messages
> more consistent.
Hmm, example in ps.c:
ioctl(fd, DEVPS_GET_NUM_PIDS, &num_pids)
and error_msg("DEVPS_GET_PID_LIST")
I think, in this not equivalent message is good, though "Can`t get pid list" is
more best ;)
--w
vodz
More information about the busybox
mailing list