writev test application. I expected this to crash haiku, but it hasn't
so far. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21828 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,5 +3,6 @@ SubDir HAIKU_TOP src tests misc ;
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
SimpleTest rtti-test : rtti-test.cpp : be ;
|
||||
SimpleTest writev-test : writev-test.cpp : be ;
|
||||
|
||||
SubInclude HAIKU_TOP src tests misc exception-test ;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#include <sys/uio.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int fd = open("testfile", O_CREAT | O_RDWR, 0666);
|
||||
|
||||
if (fd < 0) {
|
||||
printf("file open error %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int dummy;
|
||||
int ret;
|
||||
iovec vec1 = { &dummy, sizeof(dummy) };
|
||||
ret = writev(fd, &vec1, 0x80000001);
|
||||
|
||||
if (ret < 0) {
|
||||
printf("vec 1 write error %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
iovec vec2 = { (void *)0x80100000, 0x1000 };
|
||||
ret = writev(fd, &vec2, 1);
|
||||
|
||||
if (ret < 0) {
|
||||
printf("vec 2 write error %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
iovec vec3 = { 0, 1 };
|
||||
ret = writev(fd, &vec3, 0xfff);
|
||||
|
||||
if (ret < 0) {
|
||||
printf("vec 3 write error %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user