1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/socket/extconf.rb: fix the recvmsg test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2011-07-24 11:04:11 +00:00
parent f5b9de7502
commit 0283c3d0bb
2 changed files with 17 additions and 3 deletions

View file

@ -1,3 +1,7 @@
Sun Jul 24 20:02:31 2011 Tanaka Akira <akr@fsij.org>
* ext/socket/extconf.rb: fix the recvmsg test.
Sun Jul 24 08:42:51 2011 Tanaka Akira <akr@fsij.org>
* ext/socket/extconf.rb: test recvmsg allocates file descriptors for

View file

@ -147,7 +147,7 @@ int main(int argc, char *argv[])
} s_cmsg, r_cmsg;
struct iovec s_iov, r_iov;
char s_buf[1], r_buf[1];
struct stat statbuf;
struct stat s_statbuf, r_statbuf;
s_fd = 0; /* stdin */
@ -198,13 +198,23 @@ int main(int argc, char *argv[])
if (r_msg.msg_controllen < CMSG_LEN(sizeof(int))) exit(EXIT_FAILURE);
if (r_cmsg.hdr.cmsg_len < CMSG_LEN(sizeof(int))) exit(EXIT_FAILURE);
memcpy((char *)&r_fd, CMSG_DATA(&s_cmsg.hdr), sizeof(int));
memcpy((char *)&r_fd, CMSG_DATA(&r_cmsg.hdr), sizeof(int));
if (r_fd < 0) exit(EXIT_FAILURE);
ret = fstat(r_fd, &statbuf);
if (r_fd == s_fd) exit(EXIT_FAILURE);
ret = fstat(s_fd, &s_statbuf);
if (ret == -1) { exit(EXIT_FAILURE); }
ret = fstat(r_fd, &r_statbuf);
if (ret == -1) { exit(EXIT_FAILURE); }
if (s_statbuf.st_dev != r_statbuf.st_dev ||
s_statbuf.st_ino != r_statbuf.st_ino) {
exit(EXIT_FAILURE);
}
return EXIT_SUCCESS;
}
EOF