mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Make it not read stdin from a terminal or write stdout to a terminal unless forced with -f.
This commit is contained in:
parent
29dfb16c7a
commit
b06287cce5
11
main.c
11
main.c
|
|
@ -909,6 +909,17 @@ int main(int argc, char *argv[])
|
|||
sigaction(SIGTERM, &handler, 0);
|
||||
sigaction(SIGINT, &handler, 0);
|
||||
|
||||
if (!FORCE_REPLACE) {
|
||||
if (STDIN && isatty(fileno((FILE *)stdin))) {
|
||||
print_err("Will not read stdin from a terminal. Use -f to override.\n");
|
||||
exit (1);
|
||||
}
|
||||
if (STDIN && isatty(fileno((FILE *)stdout))) {
|
||||
print_err("Will not write stdout to a terminal. Use -f to override.\n");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
gettimeofday(&start_time, NULL);
|
||||
|
||||
if (control.flags & (FLAG_DECOMPRESS | FLAG_TEST_ONLY))
|
||||
|
|
|
|||
Loading…
Reference in a new issue