Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug#765410: ulimit broken as root if it fails once [origin: goswin-v-b@xxxxxx]
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@xxxxxxxxxxxxxxxx> 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];
Messages sorted by:
Reverse Date,
Date,
Thread,
Author