~ubuntu-branches/ubuntu/lucid/curl/lucid-201101212007

« back to all changes in this revision

Viewing changes to tests/libtest/lib537.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-02-08 11:20:41 UTC
  • mto: (3.1.1 lenny) (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20080208112041-hed7sb5r6ghmjf8v
Tags: upstream-7.18.0
ImportĀ upstreamĀ versionĀ 7.18.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * $Id: lib537.c,v 1.18 2007-09-30 01:27:39 yangtse Exp $
 
8
 * $Id: lib537.c,v 1.19 2008-01-17 18:57:50 yangtse Exp $
9
9
 */
10
10
 
11
11
#include "test.h"
148
148
 
149
149
  if (rl.rlim_cur != rl.rlim_max) {
150
150
 
 
151
#ifdef OPEN_MAX
 
152
    if ((rl.rlim_cur > 0) &&
 
153
        (rl.rlim_cur < OPEN_MAX)) {
 
154
      fprintf(stderr, "raising soft limit up to OPEN_MAX\n");
 
155
      rl.rlim_cur = OPEN_MAX;
 
156
      if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
 
157
        /* on failure don't abort just issue a warning */
 
158
        store_errmsg("setrlimit() failed", ERRNO);
 
159
        fprintf(stderr, "%s\n", msgbuff);
 
160
        msgbuff[0] = '\0';
 
161
      }
 
162
    }
 
163
#endif
 
164
 
151
165
    fprintf(stderr, "raising soft limit up to hard limit\n");
152
166
    rl.rlim_cur = rl.rlim_max;
153
167
    if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
 
168
      /* on failure don't abort just issue a warning */
154
169
      store_errmsg("setrlimit() failed", ERRNO);
155
170
      fprintf(stderr, "%s\n", msgbuff);
156
 
      return -2;
 
171
      msgbuff[0] = '\0';
157
172
    }
158
173
 
159
174
    /* get current open file limits */