[haiku-bugs] [Haiku] #9466: Bug in readdir_r?

  • From: "fabbo" <trac@xxxxxxxxxxxx>
  • Date: Tue, 19 Feb 2013 22:42:02 -0000

#9466: Bug in readdir_r?
-----------------------+---------------------------
 Reporter:  fabbo      |        Owner:  nobody
     Type:  bug        |       Status:  new
 Priority:  normal     |    Milestone:  R1
Component:  - General  |      Version:  R1/alpha4.1
 Keywords:             |   Blocked By:
 Blocking:             |  Has a Patch:  0
 Platform:  All        |
-----------------------+---------------------------
 I am using Haiku to build the following program

 {{{
 #!c#include <string.h>
 #include <stdlib.h>
 #include <stdio.h>

 #include <errno.h>
 #include <dirent.h>

 int main(void) {
   DIR *plugindir = opendir("loaders");
   struct dirent direntry;
   struct dirent *dirresult;
   int i;

   if (plugindir == NULL) {
     return;
   }
   do {
 #ifdef CRASH
     int res = readdir_r(plugindir, &direntry, &dirresult);
     if (res != 0) {
      printf("fail %s\n",strerror(res));
       break;
     }
 #else
   dirresult = readdir(plugindir);
 #endif

     if (dirresult == NULL)
       break;

     printf("file %s\n",dirresult->d_name);
   } while (1);
   closedir(plugindir);
   return 0;
 }
 }}}

 I use native gcc 2.95.3 (that is, no cross-compiling, gcc runs on Haiku
 itself) to build it (by the way, are newer version of gcc available?). If
 I compile it with -DCRASH, this is the output.

 {{{
 file .
 fail Operation not supported
 cr: /storage/haiku-
 
releases/r1alpha4/haiku/src/system/libroot/posix/malloc/processheap.cpp:166:void
 BPrivate::processHeap::free(void *): sb
 Kill Thread
 }}}

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/9466>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: