You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Doug MacEachern <do...@covalent.net> on 2001/06/14 07:25:30 UTC

Re: Segfault on ppc-linux with modperl-1.25 with Apache 1.3.19 when calling $r->send_fd()

On 19 Mar 2001, Mark Lipscombe wrote:


>       open ($FH, $fname);
...
>       $r->send_fd($FH);

you didn't check the return value of open();  patch below will check if
the filehandle is NULL and croak rather than segfault.

Index: src/modules/perl/Apache.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.122
diff -u -r1.122 Apache.xs
--- src/modules/perl/Apache.xs	2001/06/14 04:36:21	1.122
+++ src/modules/perl/Apache.xs	2001/06/14 05:24:25
@@ -956,6 +956,10 @@
     long length
 
     CODE:
+    if (!f) {
+        croak("send_fd: NULL filehandle "
+              "(hint: did you check the return value of open?)");
+    }
     RETVAL = send_fd_length(f, r, length);
 
     OUTPUT: