Re: [patch] fix nonsense errno code in os_linux.cpp
Maciej Żenczykowski <[email protected]> Thu, 14 Apr 2016 03:08:41 -0700
| Newsgroups | gmane.linux.utilities.smartmontools |
|---|---|
| Message-ID | <CAHo-Oox1uYAOxbxk8FDv3mXVnomuxBXw_SDewKh4MfQ37WVmOA@mail.gmail.com> |
I may be dreaming, but: While the kernel syscall ioctl returns an error, afaik the C library ioctl returns -1 and places error in errno... Like all syscall C library wrappers. I imagine you are using the C library ioctl and not the kernel interface directly, so I would imagine the code was correct (well it would be more correct to compare to -1, and then look at errno). What am I missing? On Wed, Apr 13, 2016 at 10:31 PM, Christian Franke <[email protected]> wrote: > Yuriy M. Kaminskiy wrote: >> I noticed strange code in os_linux.cpp, like this: >> >> + if (ioctl(get_fd(), HDIO_DRIVE_TASKFILE, task)) { >> + if (errno==-EINVAL) >> >> I don't think this can work as expected (fortunately, it seems it is only in >> obsolete /dev/hda support, and only used for generating "user-friendly" >> message on error path). Patch attached. > > Thanks for catching this 12 year old bug :-) > https://www.smartmontools.org/changeset/1609/trunk/sm5/os_linux.c > > I will commit it soon. > > Thanks, > Christian > > > ------------------------------------------------------------------------------ > Find and fix application performance issues faster with Applications Manager > Applications Manager provides deep performance insights into multiple tiers of > your business applications. It resolves application problems quickly and > reduces your MTTR. Get your free trial! > https://ad.doubleclick.net/ddm/clk/302982198;130105516;z > _______________________________________________ > Smartmontools-support mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/smartmontools-support ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z