lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r902825 - /lucene/lucy/trunk/core/Lucy/Store/FSFileHandle.c
Date Mon, 25 Jan 2010 14:38:52 GMT
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)));



Mime
View raw message