chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2070170
)
core: when passing resource limit values to client, map RLIM_INFINITY into portable...
author
Lennart Poettering
<lennart@poettering.net>
Wed, 5 Mar 2014 01:27:37 +0000
(
02:27
+0100)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 5 Mar 2014 01:31:09 +0000
(
02:31
+0100)
src/core/dbus-execute.c
patch
|
blob
|
history
diff --git
a/src/core/dbus-execute.c
b/src/core/dbus-execute.c
index 3a05303f084070ffa8fbcab543bc49f7420a2ec7..4c3ad6582507e85307248586702a8a1930ac0c28 100644
(file)
--- a/
src/core/dbus-execute.c
+++ b/
src/core/dbus-execute.c
@@
-87,6
+87,7
@@
static int property_get_rlimit(
struct rlimit *rl;
uint64_t u;
struct rlimit *rl;
uint64_t u;
+ rlim_t x;
assert(bus);
assert(reply);
assert(bus);
assert(reply);
@@
-94,7
+95,7
@@
static int property_get_rlimit(
rl = *(struct rlimit**) userdata;
if (rl)
rl = *(struct rlimit**) userdata;
if (rl)
-
u = (uint64_t)
rl->rlim_max;
+
x =
rl->rlim_max;
else {
struct rlimit buf = {};
int z;
else {
struct rlimit buf = {};
int z;
@@
-103,10
+104,14
@@
static int property_get_rlimit(
assert(z >= 0);
getrlimit(z, &buf);
assert(z >= 0);
getrlimit(z, &buf);
-
- u = (uint64_t) buf.rlim_max;
+ x = buf.rlim_max;
}
}
+ /* rlim_t might have different sizes, let's map
+ * RLIMIT_INFINITY to (uint64_t) -1, so that it is the same on
+ * all archs */
+ u = x == RLIM_INFINITY ? (uint64_t) -1 : (uint64_t) x;
+
return sd_bus_message_append(reply, "t", u);
}
return sd_bus_message_append(reply, "t", u);
}