From fca5d4232c292f3f7422faf957d91af18688c225 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Tue, 15 Mar 2011 09:56:45 +1100 Subject: [PATCH] Refuse to perform file info from STDIN. --- lrzip.c | 5 ++--- main.c | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lrzip.c b/lrzip.c index b1df6a4..bf8544e 100644 --- a/lrzip.c +++ b/lrzip.c @@ -700,7 +700,7 @@ void get_fileinfo(rzip_control *control) } } - /* Version < 0.4 had different file format */ + /* Versions 0.3-0.6 had different file formats */ if (control->major_version == 0 && control->minor_version < 4) seekspot = 50; else if (control->major_version == 0 && control->minor_version == 4) @@ -713,8 +713,7 @@ void get_fileinfo(rzip_control *control) fatal("Failed to lseek in get_fileinfo\n"); /* Read the compression type of the first block. It's possible that - not all blocks are compressed so this may not be accurate. - */ + not all blocks are compressed so this may not be accurate. */ if (unlikely(read(fd_in, &ctype, 1) != 1)) fatal("Failed to read in get_fileinfo\n"); diff --git a/main.c b/main.c index 477c6c8..0e8d7ad 100644 --- a/main.c +++ b/main.c @@ -654,6 +654,9 @@ int main(int argc, char *argv[]) if (control.infile && (strcmp(control.infile, "-") == 0)) control.flags |= FLAG_STDIN; + if (INFO && STDIN) + failure("Will not get file info from STDIN\n"); + if (control.outname && (strcmp(control.outname, "-") == 0)) { control.flags |= FLAG_STDOUT; control.msgout = stderr;