X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fcommon%2Frun.c;h=36f3c5e9f1e8ac3ddb64f18eb0c1bd00348cdd31;hb=157cc4927ff8aa7af63bc59f8eade6cb3f14c6d6;hp=8a2a0f34db6e2ab441d98c95f4fea9b498ffaca5;hpb=2a160f3f18b41a5647f2bc7a652959932344610b;p=libc-test diff --git a/src/common/run.c b/src/common/run.c index 8a2a0f3..36f3c5e 100644 --- a/src/common/run.c +++ b/src/common/run.c @@ -14,26 +14,14 @@ static void handler(int s) { } -static void setrl(int r, long lim) { - struct rlimit rl; - - if (getrlimit(r, &rl)) - t_error("getrlimit %d: %s\n", r, strerror(errno)); - rl.rlim_cur = lim; - if (lim < rl.rlim_max) - rl.rlim_max = lim; - if (setrlimit(r, &rl)) - t_error("setrlimit %d: %s\n", r, strerror(errno)); -} - static int start(char *argv[]) { int pid; pid = fork(); if (pid == 0) { - setrl(RLIMIT_STACK, 100*1024); - setrl(RLIMIT_CPU, 2); + t_setrlim(RLIMIT_STACK, 100*1024); + t_setrlim(RLIMIT_CPU, 2); execv(argv[0], argv); t_error("%s exec failed: %s\n", argv[0], strerror(errno)); exit(1);