blob: 0daf4f7ec9f1016e612b6d07dcbadd22508dd3b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
Patch for Debian bug #180310
Generate some (low-severity) log information whenever setrlimit() fails,
for debugging purposes.
Authors: Sam Hartman <hartmans@debian.org>
Upstream status: submitted in <20070830171918.GB30563@dario.dodds.net>
Index: debian-pkg-pam/modules/pam_limits/pam_limits.c
===================================================================
--- debian-pkg-pam.orig/modules/pam_limits/pam_limits.c 2009-04-17 12:47:06.000000000 -0700
+++ debian-pkg-pam/modules/pam_limits/pam_limits.c 2009-04-17 12:47:13.000000000 -0700
@@ -664,6 +664,19 @@
if (pl->limits[i].limit.rlim_cur > pl->limits[i].limit.rlim_max)
pl->limits[i].limit.rlim_cur = pl->limits[i].limit.rlim_max;
retval = setrlimit(i, &pl->limits[i].limit);
+ if (retval != 0 && (i != RLIMIT_NOFILE
+ || pl->limits[i].limit.rlim_cur != RLIM_INFINITY))
+ {
+ int save_errno = errno;
+ pam_syslog(pamh, LOG_DEBUG,
+ "setrlimit limit #%d to soft=%d, hard=%d failed:"
+ " %m; uid=%lu,euid=%lu", i,
+ pl->limits[i].limit.rlim_cur,
+ pl->limits[i].limit.rlim_max,
+ (unsigned long) getuid(),
+ (unsigned long) geteuid());
+ errno = save_errno;
+ }
if (retval == -1 && errno==EPERM)
continue;
status |= retval;
|