51 lines
2.0 KiB
Diff
51 lines
2.0 KiB
Diff
diff --git src/basic/format-util.h src/basic/format-util.h
|
|
index dece5d3..dbb87bc 100644
|
|
--- src/basic/format-util.h
|
|
+++ src/basic/format-util.h
|
|
@@ -42,13 +42,7 @@
|
|
# define PRI_TIMEX "li"
|
|
#endif
|
|
|
|
-#if SIZEOF_RLIM_T == 8
|
|
-# define RLIM_FMT "%" PRIu64
|
|
-#elif SIZEOF_RLIM_T == 4
|
|
-# define RLIM_FMT "%" PRIu32
|
|
-#else
|
|
-# error Unknown rlim_t size
|
|
-#endif
|
|
+#define RLIM_FMT "%ju"
|
|
|
|
#if SIZEOF_DEV_T == 8
|
|
# define DEV_FMT "%" PRIu64
|
|
diff --git src/basic/rlimit-util.c src/basic/rlimit-util.c
|
|
index 38e8873..0f7adb5 100644
|
|
--- src/basic/rlimit-util.c
|
|
+++ src/basic/rlimit-util.c
|
|
@@ -308,13 +308,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
|
|
if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
|
|
s = strdup("infinity");
|
|
else if (rl->rlim_cur >= RLIM_INFINITY)
|
|
- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
|
|
+ (void) asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
|
|
else if (rl->rlim_max >= RLIM_INFINITY)
|
|
- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
|
|
+ (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
|
|
else if (rl->rlim_cur == rl->rlim_max)
|
|
- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur);
|
|
+ (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
|
|
else
|
|
- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
|
|
+ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
|
|
|
|
if (!s)
|
|
return -ENOMEM;
|
|
@@ -406,7 +406,7 @@ int rlimit_nofile_safe(void) {
|
|
|
|
rl.rlim_cur = FD_SETSIZE;
|
|
if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
|
|
- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
|
|
+ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
|
|
|
|
return 1;
|
|
}
|