diff options
| -rw-r--r-- | meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch | 89 | ||||
| -rw-r--r-- | meta/recipes-core/systemd/systemd_234.bb | 1 |
2 files changed, 90 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch new file mode 100644 index 0000000000..779dc78fd3 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | From b2d4171c6e521cf1e70331fb769234d63a4a6d44 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Fri, 27 Oct 2017 13:00:41 -0700 | ||
| 4 | Subject: [PATCH] Use uintmax_t for handling rlim_t | ||
| 5 | |||
| 6 | PRIu{32,64} is not right format to represent rlim_t type | ||
| 7 | therefore use %ju and typecast the rlim_t variables to | ||
| 8 | uintmax_t. | ||
| 9 | |||
| 10 | Fixes portablility errors like | ||
| 11 | |||
| 12 | execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=] | ||
| 13 | | fprintf(f, "%s%s: " RLIM_FMT "\n", | ||
| 14 | | ^~~~~~~~ | ||
| 15 | | prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); | ||
| 16 | | ~~~~~~~~~~~~~~~~~~~~~~ | ||
| 17 | |||
| 18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 19 | --- | ||
| 20 | Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/7199] | ||
| 21 | |||
| 22 | src/basic/format-util.h | 8 -------- | ||
| 23 | src/basic/rlimit-util.c | 8 ++++---- | ||
| 24 | src/core/execute.c | 8 ++++---- | ||
| 25 | 3 files changed, 8 insertions(+), 16 deletions(-) | ||
| 26 | |||
| 27 | diff --git a/src/basic/format-util.h b/src/basic/format-util.h | ||
| 28 | index ae42a8f89..144249cd6 100644 | ||
| 29 | --- a/src/basic/format-util.h | ||
| 30 | +++ b/src/basic/format-util.h | ||
| 31 | @@ -60,14 +60,6 @@ | ||
| 32 | # define PRI_TIMEX "li" | ||
| 33 | #endif | ||
| 34 | |||
| 35 | -#if SIZEOF_RLIM_T == 8 | ||
| 36 | -# define RLIM_FMT "%" PRIu64 | ||
| 37 | -#elif SIZEOF_RLIM_T == 4 | ||
| 38 | -# define RLIM_FMT "%" PRIu32 | ||
| 39 | -#else | ||
| 40 | -# error Unknown rlim_t size | ||
| 41 | -#endif | ||
| 42 | - | ||
| 43 | #if SIZEOF_DEV_T == 8 | ||
| 44 | # define DEV_FMT "%" PRIu64 | ||
| 45 | #elif SIZEOF_DEV_T == 4 | ||
| 46 | diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c | ||
| 47 | index ca834df62..41fcebb74 100644 | ||
| 48 | --- a/src/basic/rlimit-util.c | ||
| 49 | +++ b/src/basic/rlimit-util.c | ||
| 50 | @@ -284,13 +284,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { | ||
| 51 | if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) | ||
| 52 | s = strdup("infinity"); | ||
| 53 | else if (rl->rlim_cur >= RLIM_INFINITY) | ||
| 54 | - (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); | ||
| 55 | + (void) asprintf(&s, "infinity:%ju", (uintmax_t)rl->rlim_max); | ||
| 56 | else if (rl->rlim_max >= RLIM_INFINITY) | ||
| 57 | - (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); | ||
| 58 | + (void) asprintf(&s, "%ju:infinity", (uintmax_t)rl->rlim_cur); | ||
| 59 | else if (rl->rlim_cur == rl->rlim_max) | ||
| 60 | - (void) asprintf(&s, RLIM_FMT, rl->rlim_cur); | ||
| 61 | + (void) asprintf(&s, "%ju", (uintmax_t)rl->rlim_cur); | ||
| 62 | else | ||
| 63 | - (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); | ||
| 64 | + (void) asprintf(&s, "%ju:%ju", (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); | ||
| 65 | |||
| 66 | if (!s) | ||
| 67 | return -ENOMEM; | ||
| 68 | diff --git a/src/core/execute.c b/src/core/execute.c | ||
| 69 | index d72e5bf08..d38946002 100644 | ||
| 70 | --- a/src/core/execute.c | ||
| 71 | +++ b/src/core/execute.c | ||
| 72 | @@ -3443,10 +3443,10 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { | ||
| 73 | |||
| 74 | for (i = 0; i < RLIM_NLIMITS; i++) | ||
| 75 | if (c->rlimit[i]) { | ||
| 76 | - fprintf(f, "%s%s: " RLIM_FMT "\n", | ||
| 77 | - prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); | ||
| 78 | - fprintf(f, "%s%sSoft: " RLIM_FMT "\n", | ||
| 79 | - prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur); | ||
| 80 | + fprintf(f, "%s%s: %ju\n", | ||
| 81 | + prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max); | ||
| 82 | + fprintf(f, "%s%sSoft: %ju\n", | ||
| 83 | + prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur); | ||
| 84 | } | ||
| 85 | |||
| 86 | if (c->ioprio_set) { | ||
| 87 | -- | ||
| 88 | 2.14.3 | ||
| 89 | |||
diff --git a/meta/recipes-core/systemd/systemd_234.bb b/meta/recipes-core/systemd/systemd_234.bb index bcb683f10a..6b8745b93f 100644 --- a/meta/recipes-core/systemd/systemd_234.bb +++ b/meta/recipes-core/systemd/systemd_234.bb | |||
| @@ -40,6 +40,7 @@ SRC_URI = "git://github.com/systemd/systemd.git;protocol=git \ | |||
| 40 | file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ | 40 | file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ |
| 41 | file://0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ | 41 | file://0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ |
| 42 | file://0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch \ | 42 | file://0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch \ |
| 43 | file://0001-Use-uintmax_t-for-handling-rlim_t.patch \ | ||
| 43 | " | 44 | " |
| 44 | SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch" | 45 | SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch" |
| 45 | 46 | ||
