You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2010/01/25 15:38:52 UTC

svn commit: r902825 - /lucene/lucy/trunk/core/Lucy/Store/FSFileHandle.c

Author: marvin
Date: Mon Jan 25 14:38:52 2010
New Revision: 902825

URL: http://svn.apache.org/viewvc?rev=902825&view=rev
Log:
Add a manual check for write-only file descriptors for 64-bit FSFH_Read(),
necessary because unlike the 32-bit version, there's no system call to fail.

Modified:
    lucene/lucy/trunk/core/Lucy/Store/FSFileHandle.c

Modified: lucene/lucy/trunk/core/Lucy/Store/FSFileHandle.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Store/FSFileHandle.c?rev=902825&r1=902824&r2=902825&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Store/FSFileHandle.c (original)
+++ lucene/lucy/trunk/core/Lucy/Store/FSFileHandle.c Mon Jan 25 14:38:52 2010
@@ -254,6 +254,12 @@
 FSFH_read(FSFileHandle *self, char *dest, i64_t offset, size_t len)
 {
     const i64_t end = offset + len;
+
+    if (self->flags & FH_WRITE_ONLY) {
+        Err_set_error(Err_new(CB_newf(
+            "Can't read from write-only filehandle")));
+        return false;
+    }
     if (offset < 0) {
         Err_set_error(Err_new(CB_newf(
             "Can't read from an offset less than 0 (%i64)", offset)));