commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hurd/libstore ChangeLog rdwr.c


From: Marcus Brinkmann
Subject: hurd/libstore ChangeLog rdwr.c
Date: Mon, 04 Aug 2003 18:00:24 -0400

CVSROOT:        /cvsroot/hurd
Module name:    hurd
Branch:         
Changes by:     Marcus Brinkmann <address@hidden>       03/08/04 18:00:24

Modified files:
        libstore       : ChangeLog rdwr.c 

Log message:
        2003-07-21  Ognyan Kulev  <address@hidden>
        
        * rdwr.c (store_write): Return EINVAL when LEN is not aligned to
        STORE->block_size, instead of raising assertion failure.
        (store_read): Likewise.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libstore/ChangeLog.diff?tr1=1.96&tr2=1.97&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libstore/rdwr.c.diff?tr1=1.26&tr2=1.27&r1=text&r2=text

Patches:
Index: hurd/libstore/ChangeLog
diff -u hurd/libstore/ChangeLog:1.96 hurd/libstore/ChangeLog:1.97
--- hurd/libstore/ChangeLog:1.96        Mon Aug  4 14:05:32 2003
+++ hurd/libstore/ChangeLog     Mon Aug  4 18:00:24 2003
@@ -1,3 +1,9 @@
+2003-07-21  Ognyan Kulev  <address@hidden>
+
+       * rdwr.c (store_write): Return EINVAL when LEN is not aligned to
+       STORE->block_size, instead of raising assertion failure.
+       (store_read): Likewise.
+
 2003-08-04  Roland McGrath  <address@hidden>
 
        * typed.c (store_find_class): Use dlopen/dlclose on the names found by
Index: hurd/libstore/rdwr.c
diff -u hurd/libstore/rdwr.c:1.26 hurd/libstore/rdwr.c:1.27
--- hurd/libstore/rdwr.c:1.26   Tue Dec  3 12:47:06 2002
+++ hurd/libstore/rdwr.c        Mon Aug  4 18:00:24 2003
@@ -1,6 +1,6 @@
 /* Store I/O
 
-   Copyright (C) 1995,96,97,98,99,2001,02 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999,2001,2002,2003 Free Software Foundation, Inc.
    Written by Miles Bader <address@hidden>
    This file is part of the GNU Hurd.
 
@@ -89,8 +89,6 @@
     return 1;
 }
 
-#include <assert.h>
-
 /* Write LEN bytes from BUF to STORE at ADDR.  Returns the amount written
    in AMOUNT.  ADDR is in BLOCKS (as defined by STORE->block_size).  */
 error_t
@@ -110,8 +108,8 @@
   if ((addr << block_shift) + len > store->size)
     return EIO;
 
-  if (store->block_size != 0)
-    assert ((len & (store->block_size - 1)) == 0);
+  if (store->block_size != 0 && (len & (store->block_size - 1)) != 0)
+    return EINVAL;
 
   addr = store_find_first_run (store, addr, &run, &runs_end, &base, &index);
   if (addr < 0)
@@ -190,8 +188,8 @@
   if ((addr << block_shift) + amount > store->size)
     amount = store->size - (addr << block_shift);
 
-  if (store->block_size != 0)
-    assert ((amount & (store->block_size - 1)) == 0);
+  if (store->block_size != 0 && (amount & (store->block_size - 1)) != 0)
+    return EINVAL;
 
   if ((amount >> block_shift) <= run->length - addr)
     /* The first run has it all... */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]