]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
irqtop/lsirq: Handle EOF in get_irqinfo
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 12 Apr 2026 11:22:13 +0000 (13:22 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 12 Apr 2026 11:22:13 +0000 (13:22 +0200)
If an empty file is passed to get_irqinfo, getline fails without setting
errno because EOF is not an error condition, even though -1 is returned.

Suppress error message but keep the regular error handling.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
sys-utils/irq-common.c

index 4efe192773cf32cc637ed6d6b35afb996876df16..37f839b44626207c6eda3d528f4e381e2c07138d 100644 (file)
@@ -257,7 +257,8 @@ static struct irq_stat *get_irqinfo(const char *input_file, int softirq,
 
        /* read header firstly */
        if (getline(&line, &len, irqfile) < 0) {
-               warn(_("cannot read %s"), input_file);
+               if (!feof(irqfile))
+                       warn(_("cannot read %s"), input_file);
                goto close_file;
        }