Make tell() fail properly if called without an argument and when no previous file...
Rafael Garcia-Suarez [Thu, 8 Oct 2009 09:44:21 +0000 (11:44 +0200)]
This makes tell() return -1, and sets errno to EBADF, thus
restoring the 5.8.x behaviour

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) );