]> granicus.if.org Git - sysstat/commitdiff
sar: Allow option -i when no input file is specified
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 27 Apr 2019 12:46:53 +0000 (14:46 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 27 Apr 2019 12:46:53 +0000 (14:46 +0200)
Option -i can be used if no datafile is specified  by the user (e.g. a
syntax like "sar -i 600" should not display an error).

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sar.c

diff --git a/sar.c b/sar.c
index 495a83b8041a7c66904d287371e96536562e7a2d..5bf54e1aaa5f64d8f5fb372a42746b068263b028 100644 (file)
--- a/sar.c
+++ b/sar.c
@@ -1472,7 +1472,7 @@ int main(int argc, char **argv)
 
        /* 'sar' is equivalent to 'sar -f' */
        if ((argc == 1) ||
-           ((interval < 0) && !from_file[0] && !to_file[0])) {
+           (((interval < 0) || INTERVAL_SET(flags)) && !from_file[0] && !to_file[0])) {
                set_default_file(from_file, day_offset, -1);
        }