On Thu, 5 May 2005, Markus Wichitill wrote:

> Steve Hay wrote:
> >>how can we test if the filehandle is valid then? may be we should skip
> >>that bit altogether? Steve, does it work if you comment out the whole
> >>
> >>  if (!size) { ... }
> >>
> >>block?
> >
> > No, it doesn't :(
>
> I've removed the size code, too, and the problem is that after the exception
> is thrown, neither of the tests in RegistryCooker::read_script apply:
>
>          if (ref $@ eq 'APR::Error') {
>              return Apache2::Const::FORBIDDEN if $@ == APR::Const::EACCES;
>              return Apache2::Const::NOT_FOUND if $@ == APR::Const::ENOENT;
>              # oops
>          }
>
> The actual error code returned by apr_file_open is 720002.
>

Does the following fix this?

===================================================================
Index: xs/APR/Status/APR__Status.h
===================================================================
--- xs/APR/Status/APR__Status.h (revision 168337)
+++ xs/APR/Status/APR__Status.h (working copy)
@@ -16,3 +16,5 @@
 #include "apr_errno.h"

 #define mpxs_APR__Status_is_EAGAIN APR_STATUS_IS_EAGAIN
+#define mpxs_APR__Status_is_EACCES APR_STATUS_IS_EACCES
+#define mpxs_APR__Status_is_ENOENT APR_STATUS_IS_ENOENT
Index: xs/maps/apr_functions.map
===================================================================
--- xs/maps/apr_functions.map   (revision 168337)
+++ xs/maps/apr_functions.map   (working copy)
@@ -649,3 +649,5 @@

 MODULE=APR::Status      PREFIX=mpxs_APR__STATUS_
  int:DEFINE_is_EAGAIN | | apr_status_t:rc
+ int:DEFINE_is_EACCES | | apr_status_t:rc
+ int:DEFINE_is_ENOENT | | apr_status_t:rc
Index: ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
===================================================================
--- ModPerl-Registry/lib/ModPerl/RegistryCooker.pm      (revision 168337)
+++ ModPerl-Registry/lib/ModPerl/RegistryCooker.pm      (working copy)
@@ -34,6 +34,7 @@
 use Apache2::Access ();

 use APR::Table ();
+use APR::Status ();

 use ModPerl::Util ();
 use ModPerl::Global ();
@@ -41,7 +42,6 @@
 use File::Spec::Functions ();
 use File::Basename;

-use APR::Const     -compile => qw(EACCES ENOENT);
 use Apache2::Const  -compile => qw(:common &OPT_EXECCGI);
 use ModPerl::Const -compile => 'EXIT';

@@ -542,8 +542,8 @@
         $self->log_error("$@");

         if (ref $@ eq 'APR::Error') {
-            return Apache2::Const::FORBIDDEN if $@ == APR::Const::EACCES;
-            return Apache2::Const::NOT_FOUND if $@ == APR::Const::ENOENT;
+            return Apache2::Const::FORBIDDEN if APR::Status::is_EACCES($@);
+            return Apache2::Const::NOT_FOUND if APR::Status::is_ENOENT($@);
         }
         else {
             return Apache2::Const::SERVER_ERROR;

========================================================================

-- 
best regards,
randy

Reply via email to