You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2008/03/04 20:37:45 UTC
DO NOT REPLY [Bug 44533] New: apr_dir_read segfaults
https://issues.apache.org/bugzilla/show_bug.cgi?id=44533
Summary: apr_dir_read segfaults
Product: APR
Version: HEAD
Platform: PC
OS/Version: Linux
Status: NEW
Severity: major
Priority: P3
Component: APR
AssignedTo: bugs@apr.apache.org
ReportedBy: etienne.phillips@gmail.com
Hi
This code:
[code]
#include <stdio.h>
#include <apr_general.h>
#include <apr_file_io.h>
int main(int argc, const char *argv[])
{
apr_pool_t *mp;
apr_initialize();
apr_pool_create(&mp, NULL);
apr_dir_t* dev_dir;
apr_dir_open(&dev_dir, "/dev", mp);
apr_finfo_t* fileinfo;
while (apr_dir_read(fileinfo, 0, dev_dir) == APR_SUCCESS)
{
printf("%s\n",fileinfo->name);
}
return 0;
}
[/code]
segfaults on line 17 (while apr_dir_read...) on Ubuntu 7.04 (kernel
2.6.20-15-generic) when compiled with gcc (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4).
This is on a VIA C7 x86 compatible processor.
The interesting bit of the crash, when run in gdb is:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211336480 (LWP 7735)]
0xb7f77a82 in apr_dir_read () from /usr/lib/libapr-1.so.0
(gdb) bt
#0 0xb7f77a82 in apr_dir_read () from /usr/lib/libapr-1.so.0
#1 0x08048681 in main () at ../apr_testing.c++:17
This code runs perfectly on Mac OS X 10.4.11, when compiled with
i686-apple-darwin8-gcc-4.0.1, running on a MacBookPro 1,1 (Intel CoreDuo). I am
using the latest APR package on both platforms (apr-1.12).
Any ideas?
Thanks
Etienne
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org
DO NOT REPLY [Bug 44533] apr_dir_read segfaults
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44533
Ruediger Pluem <rp...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Ruediger Pluem <rp...@apache.org> 2008-03-04 13:58:38 ---
Your test program is buggy. It must be
apr_finfo_t fileinfo;
while (apr_dir_read(i&fileinfo, 0, dev_dir) == APR_SUCCESS)
{
printf("%s\n",fileinfo.name);
}
instead and everything works as designed.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org
DO NOT REPLY [Bug 44533] apr_dir_read segfaults
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44533
--- Comment #2 from Ruediger Pluem <rp...@apache.org> 2008-03-04 14:05:49 ---
Of course it must be
while (apr_dir_read(&fileinfo, 0, dev_dir) == APR_SUCCESS)
instead of
while (apr_dir_read(i&fileinfo, 0, dev_dir) == APR_SUCCESS)
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org
DO NOT REPLY [Bug 44533] apr_dir_read segfaults
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44533
--- Comment #3 from Etienne <et...@gmail.com> 2008-03-04 20:16:13 ---
How embarrassing!
Yes, as expected, changing the code to your suggestion fixed the problem... I
am amazed though that the compiler doesn't complain about it, and that it
actually worked on the Mac!
Apologies for posting a false bug!
Etienne
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org