    return ((fp->_flags & _IO_NO_WRITES) != 0
  	  || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
  	      && fp->_IO_read_base != NULL));
-diff -urN --strip-trailing-cr coreutils-6.12/lib/freadptr.c coreutils-6.12-haiku/lib/freadptr.c
+diff -urN coreutils-6.12/lib/freadptr.c coreutils-6.12-haiku/lib/freadptr.c
 --- coreutils-6.12/lib/freadptr.c	2008-05-14 12:53:25.000000000 +0000
 +++ coreutils-6.12-haiku/lib/freadptr.c	2008-10-02 12:32:42.000000000 +0000
 @@ -29,7 +29,7 @@

   fp->_flags |= _IO_ERR_SEEN;
 #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
   fp_->_flags |= __SERR;
diff -urN --strip-trailing-cr coreutils-6.12/src/remove.c coreutils-6.12-haiku/src/remove.c
--- coreutils-6.12/src/remove.c	2008-05-06 09:28:24.000000000 +0000
+++ coreutils-6.12-haiku/src/remove.c	2008-10-02 14:13:30.000000000 +0000
@@ -264,9 +264,10 @@
 {
   size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);

   if (top->unremovable)
     hash_free (top->unremovable);
   obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
@@ -836,14 +838,13 @@
 {
   int write_protected = 0;
   int dirent_type = *pdirent_type;
-
+  int wp_errno = 0;
+  
   *is_empty = T_UNKNOWN;
 
   if (x->interactive == RMI_NEVER)
     return RM_OK;
 
-  int wp_errno = 0;
-
   if (!x->ignore_missing_files
       && ((x->interactive == RMI_ALWAYS) || x->stdin_tty)
       && dirent_type != DT_LNK)
@@ -891,6 +892,7 @@
 	    break;
 	  }
 
