From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Cc: 765410@bugs.debian.org
Subject: Re: Bug#765410: ulimit broken as root if it fails once [origin: goswin-v-b@web.de]
Date: Wed, 22 Oct 2014 00:42:02 -0700 [thread overview]
Message-ID: <141022004202.ZM16141@torch.brasslantern.com> (raw)
In-Reply-To: <20141016092226.01b96c87@pwslap01u.europe.root.pri>
On Oct 16, 9:22am, Peter Stephenson wrote:
} Subject: Re: Bug#765410: ulimit broken as root if it fails once [origin: g
}
} On Wed, 15 Oct 2014 19:49:13 -0700
} Bart Schaefer <schaefer@brasslantern.com> wrote:
} > This could also be fixed by having bin_ulimit read back the actual limit
} > after a failure to set the hard limit and store that instead of keeping
} > the "desired" hard limit around and trying to change it again.
}
} I think that would be preferable --- I noted after the last ulimit query
} (zsh-workers/33363, about a different implementation oddity) that this
} looked potentially confusing.
Patch below fixes the command name in the warning message as well.
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 9da3183..85ec181 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -518,7 +518,7 @@ do_limit(char *nam, int lim, rlim_t val, int hard, int soft, int set)
}
} else
limits[lim].rlim_cur = val;
- if (set && zsetlimit(lim, "limit"))
+ if (set && zsetlimit(lim, nam))
return 1;
}
}
diff --git a/Src/exec.c b/Src/exec.c
index d0fadd6..2f896d8 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -250,6 +250,7 @@ zsetlimit(int limnum, char *nam)
if (setrlimit(limnum, limits + limnum)) {
if (nam)
zwarnnam(nam, "setrlimit failed: %e", errno);
+ limits[limnum] = current_limits[limnum];
return -1;
}
current_limits[limnum] = limits[limnum];
prev parent reply other threads:[~2014-10-22 7:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 22:33 Fwd: " Axel Beckert
2014-10-16 2:49 ` Bart Schaefer
2014-10-16 8:22 ` Peter Stephenson
2014-10-22 7:42 ` Bart Schaefer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=141022004202.ZM16141@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=765410@bugs.debian.org \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).