mirror of
https://github.com/ceph/ceph
synced 2024-12-22 03:22:00 +00:00
ceph_objectstore_tool: read_fd() doesn't handle ^D from tty stdin, don't allow
Signed-off-by: David Zafman <dzafman@redhat.com>
This commit is contained in:
parent
3de2d3bfb3
commit
5cb692528e
@ -2694,6 +2694,12 @@ int main(int argc, char **argv)
|
||||
} else {
|
||||
int fd;
|
||||
if (vm.count("arg1") == 0 || arg1 == "-") {
|
||||
// Since read_fd() doesn't handle ^D from a tty stdin, don't allow it.
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
cerr << "stdin is a tty and no file specified" << std::endl;
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
fd = STDIN_FILENO;
|
||||
} else {
|
||||
fd = open(arg1.c_str(), O_RDONLY|O_LARGEFILE, 0666);
|
||||
@ -2723,6 +2729,12 @@ int main(int argc, char **argv)
|
||||
|
||||
int fd;
|
||||
if (vm.count("arg2") == 0 || arg2 == "-") {
|
||||
// Since read_fd() doesn't handle ^D from a tty stdin, don't allow it.
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
cerr << "stdin is a tty and no file specified" << std::endl;
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
fd = STDIN_FILENO;
|
||||
} else {
|
||||
fd = open(arg2.c_str(), O_RDONLY|O_LARGEFILE, 0666);
|
||||
@ -2758,6 +2770,12 @@ int main(int argc, char **argv)
|
||||
|
||||
int fd;
|
||||
if (vm.count("arg2") == 0 || arg2 == "-") {
|
||||
// Since read_fd() doesn't handle ^D from a tty stdin, don't allow it.
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
cerr << "stdin is a tty and no file specified" << std::endl;
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
fd = STDIN_FILENO;
|
||||
} else {
|
||||
fd = open(arg2.c_str(), O_RDONLY|O_LARGEFILE, 0666);
|
||||
@ -2793,6 +2811,12 @@ int main(int argc, char **argv)
|
||||
usage(desc);
|
||||
int fd;
|
||||
if (vm.count("arg1") == 0 || arg1 == "-") {
|
||||
// Since read_fd() doesn't handle ^D from a tty stdin, don't allow it.
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
cerr << "stdin is a tty and no file specified" << std::endl;
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
fd = STDIN_FILENO;
|
||||
} else {
|
||||
fd = open(arg1.c_str(), O_RDONLY|O_LARGEFILE, 0666);
|
||||
|
Loading…
Reference in New Issue
Block a user