summaryrefslogtreecommitdiffstats
path: root/toolbox/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'toolbox/ioctl.c')
-rw-r--r--toolbox/ioctl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/toolbox/ioctl.c b/toolbox/ioctl.c
index 17fabff..fd90812 100644
--- a/toolbox/ioctl.c
+++ b/toolbox/ioctl.c
@@ -63,10 +63,14 @@ int ioctl_main(int argc, char *argv[])
exit(1);
}
- fd = open(argv[optind], O_RDWR | O_SYNC);
- if (fd < 0) {
- fprintf(stderr, "cannot open %s\n", argv[optind]);
- return 1;
+ if (!strcmp(argv[optind], "-")) {
+ fd = STDIN_FILENO;
+ } else {
+ fd = open(argv[optind], read_only ? O_RDONLY : (O_RDWR | O_SYNC));
+ if (fd < 0) {
+ fprintf(stderr, "cannot open %s\n", argv[optind]);
+ return 1;
+ }
}
optind++;