diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-03-05 02:27:37 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-03-05 02:31:09 +0100 |
commit | a049d1a9723b6608e45bf8f1a64dab5761dee555 (patch) | |
tree | 818bfcfe7b405cf7a19952a310f3ddec8aada502 /src | |
parent | 207017017db91232189226bfcf29e61926310a9b (diff) |
core: when passing resource limit values to client, map RLIM_INFINITY into portable value (uint64_t) -1
Diffstat (limited to 'src')
-rw-r--r-- | src/core/dbus-execute.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 3a05303f08..4c3ad65825 100644 --- 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; + rlim_t x; assert(bus); assert(reply); @@ -94,7 +95,7 @@ static int property_get_rlimit( rl = *(struct rlimit**) userdata; if (rl) - u = (uint64_t) rl->rlim_max; + x = rl->rlim_max; else { struct rlimit buf = {}; int z; @@ -103,10 +104,14 @@ static int property_get_rlimit( 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); } |