This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make tell() fail properly if called without an argument and when no previous file...
[perl5.git] / pp_sys.c
index ec12cd4..9a1d1b3 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2090,6 +2090,12 @@ PP(pp_tell)
            RETURN;
        }
     }
+    else {
+       if (!errno)
+           SETERRNO(EBADF,RMS_IFI);
+       PUSHi(-1);
+       RETURN;
+    }
 
 #if LSEEKSIZE > IVSIZE
     PUSHn( do_tell(gv) );