Keith, this code is incorrect. The second argument to readdir64_r is
supposed to point to somewhere to store the result; instead you're just
passing it an uninitialised pointer. Understandably, it segfaults.

In order to correct it, one must also define a feature test macro to get
the definition of 'struct dirent64'. Here's corrected code, which does
not segfault:

#define _LARGEFILE64_SOURCE
#include <sys/types.h>
#include <dirent.h>

int main() {
 DIR *d;
 struct dirent64 dent;
 struct dirent64 *dresult;
 d = opendir("/tmp");
 readdir64_r(d, &dent, &dresult);
 closedir(d);
}

-- 
package ubuntu-docs 8.04.2~hardy failed to install/upgrade: subprocess 
post-installation script returned error exit status 139
https://bugs.launchpad.net/bugs/220762
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to