Call for testing: OpenSSH-5.9

Darren Tucker dtucker at zip.com.au
Mon Aug 29 18:31:20 EST 2011


On Mon, Aug 29, 2011 at 2:48 PM, Darren Tucker <dtucker at zip.com.au> wrote:
[...]
> confirmed: it's poll.

Actually now I'm not sure about that.  Or rather I still think it's
poll, but maybe not in the place I originally thought.

While trying to convert the testcase into a configure test, I found
that my testcase also fails on Linux where the sandbox (appears to)
work and now I'm confused.

Here's what I'm currently using:

$ cat polltest.c
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>
#include <poll.h>
#include <errno.h>
#include <fcntl.h>

int main(int argc, char **argv)
{
	struct rlimit rl_zero;
	struct pollfd pfd;
	int r, enforce_limit = 0;

	if (argc == 2 && strcmp(argv[1], "limit") == 0)
		enforce_limit = 1;

	pfd.fd = open("/dev/null", O_RDONLY);
	pfd.events = POLLIN;

	if (enforce_limit) {
		rl_zero.rlim_cur = rl_zero.rlim_max = 0;
		setrlimit(RLIMIT_FSIZE, &rl_zero);
		setrlimit(RLIMIT_NOFILE, &rl_zero);
	}

	r = poll(&pfd, 1, -1);
	printf("poll = %d, error: %s\n", r, strerror(errno));
}

$ gcc polltest.c && ./a.out ; ./a.out limit
poll = 1, error: Success
poll = -1, error: Invalid argument

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.


More information about the openssh-unix-dev mailing list