commit 2734c578dc2b725da22c1d362ae27f9acc3a4a51
Author: root <root@debian.(none)>
Date:   Mon Nov 11 17:55:39 2013 +0100

    Added a check of "-r -O FILE" option combination.
    Allow it only if FILE is a regular file (bug #40426)
    
    Daniele Calore
    --

diff --git a/ChangeLog b/ChangeLog
index a0b99df..d40e3d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-11  Daniele Calore <daniele.calore@tin.it>
+	* main.c: added check of "-r -O FILE" option combination
+	  allow only if FILE is a regular file (bug #40426)
+
 2013-09-13  Tim Ruehsen  <tim.ruehsen@gmx.de>
 
 	* configure.ac: added a summary of build options
diff --git a/src/main.c b/src/main.c
index 19d7253..d051f7c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1549,9 +1549,9 @@ for details.\n\n"));
           if (fstat (fileno (output_stream), &st) == 0 && S_ISREG (st.st_mode))
             output_stream_regular = true;
         }
-      if (!output_stream_regular && opt.convert_links)
+      if (!output_stream_regular && (opt.convert_links || opt.recursive))
         {
-          fprintf (stderr, _("-k can be used together with -O only if \
+          fprintf (stderr, _("-k or -r can be used together with -O only if \
 outputting to a regular file.\n"));
           print_usage (1);
           exit(1);
