---
 tar.1 | 4 +++-
 tar.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tar.1 b/tar.1
index 6341e17da4d0..ff6578b56d5c 100644
--- a/tar.1
+++ b/tar.1
@@ -32,7 +32,9 @@ before beginning.
 .It Fl f Ar file
 Set
 .Ar file
-as input | output archive instead of stdin | stdout.
+as input | output archive instead of stdin | stdout. The -
+.Ar file
+is interpreted as stdin | stdout.
 .It Fl m
 Do not preserve modification time.
 .It Fl t
diff --git a/tar.c b/tar.c
index 8dbce22cc501..488beec605d5 100644
--- a/tar.c
+++ b/tar.c
@@ -510,6 +510,8 @@ main(int argc, char *argv[])
                break;
        case 'f':
                file = EARGF(usage());
+               if (file[0] == '-')
+                       file = NULL;
                break;
        case 'm':
                mflag = 1;
-- 
2.4.0


Reply via email to