Commit d0907b06 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(find_limits): The code failed to compile unless HAVE_GETDTABLESIZE.

	Flush stdout before writing something to stderr.
(main): Flush stdout before writing something to stderr.
parent 5eece712
......@@ -91,7 +91,7 @@ find_limits(const char *s,
printf("%sgetdtablesize: %ld\n", s, p->getdtable);
#else
printf("%sgetdtablesize: n/a\n", s);
p->getdtablesize = 0;
p->getdtable = 0;
#endif
#ifdef OPEN_MAX
......@@ -105,6 +105,7 @@ find_limits(const char *s,
#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)
if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
{
fflush(stdout);
perror("ERROR: testfd: getrlimit(RLIMIT_NOFILE) failed");
exit(1);
}
......@@ -159,12 +160,14 @@ main(void)
#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)
if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
{
fflush(stdout);
perror("ERROR: testfd: post-setrlimit getrlimit failed");
exit(1);
}
rlim.rlim_cur = LOW_LIMIT;
if (setrlimit(RLIMIT_NOFILE, &rlim) < 0)
{
fflush(stdout);
perror("ERROR: testfd: post-setrlimit getrlimit failed");
exit(1);
}
......@@ -172,6 +175,8 @@ main(void)
find_limits("post-", &s.post);
fflush(stdout);
if (s.post.max_seen != 0 && s.post.max_seen != LOW_LIMIT)
{
fprintf(stderr, "ERROR: open-post not equal to LOW_LIMIT\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment