]> git.ipfire.org Git - thirdparty/util-linux.git/commit
more: improve error messaging when input file is directory
authorSami Kerola <kerolasa@iki.fi>
Wed, 11 Nov 2020 20:41:17 +0000 (20:41 +0000)
committerSami Kerola <kerolasa@iki.fi>
Sat, 14 Nov 2020 16:07:05 +0000 (16:07 +0000)
commit32a4efc5675ca238d382a0027f7f4723b8b3af28
treed9d6230f587c941083f74f0ce7ae45c243ededff
parent792ff9fcee1bad2b8a43e83f921aa01d96cd3188
more: improve error messaging when input file is directory

Before this change the error message about directory was not informative,
and a little bit out of place.

    $ touch empty ; ./more ./empty /
    ::::::::::::::
    ./empty
    ::::::::::::::
    magic failed: cannot read fd 4 (Is a directory)
    ::::::::::::::
    /
    ::::::::::::::

After the change messaging is reverted back to what it used to be.

    $ ./more ./empty /
    ::::::::::::::
    ./empty
    ::::::::::::::

    *** /: directory ***

And while on it lets remove repeated fstat() call.

Fixes: 09070e1a658e70ec203150e4fa5f486b32771858
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
text-utils/more.c