Commit Graph

5102 Commits

Author SHA1 Message Date
Jan Engelhardt
18fe76eba5 doc: correct wrong use "'s" contractions 2023-03-07 13:39:31 +01:00
Yu Watanabe
9d0d39ee53 conf-files: fix potential memleak in conf_files_list_strv_internal() on failure
This also changes the used hash_ops from path_hash_ops to
string_hash_ops, as the key is not a path, but a filename.
2023-03-07 18:43:34 +09:00
Luca Boccassi
df40b7ef5a Merge pull request #26686 from yuwata/iovec
tree-wide: replace IOVEC_INIT with IOVEC_MAKE
2023-03-06 21:00:04 +00:00
Luca Boccassi
db73b9d2ab Merge pull request #26502 from DaanDeMeyer/chase-symlinks-additions
Several chase_symlinks() additions
2023-03-06 20:51:06 +00:00
Luca Boccassi
52bdfbf7d7 Merge pull request #26687 from yuwata/c2x
C2X support
2023-03-06 20:50:17 +00:00
Yu Watanabe
84d0dc53ac time-util: drop redundant call of tzset()
It is also called at the beginning of `parse_timestamp_maybe_with_tz()`.
2023-03-06 20:39:37 +00:00
Daan De Meyer
9a98c0f2b1 chase-symlinks: Add chase_symlinks_at_and_open() 2023-03-06 13:53:01 +01:00
Daan De Meyer
e864dfa671 chase-symlinks: Add CHASE_MKDIR_0755 2023-03-06 13:42:43 +01:00
Daan De Meyer
28aa650eb7 chase-symlinks: Add CHASE_PARENT
Let's simplify chasing the parent directory of some path by adding
CHASE_PARENT.
2023-03-06 13:42:43 +01:00
Daan De Meyer
7bf4057d79 chase-symlinks: Return "." as path from chase_symlinks_at() instead of NULL 2023-03-06 13:42:40 +01:00
Daan De Meyer
577efd82f2 chase-symlinks: Skip shortcuts if CHASE_PROHIBIT_SYMLINKS is set 2023-03-06 13:41:02 +01:00
Cristian Rodríguez
5545f336fd Include <threads.h> if possible to get thread_local definition
IN C23, thread_local is a reserved keyword and we shall therefore
do nothing to redefine it. glibc has it defined for older standard
version with the right conditions.

v2 by Yu Watanabe:
Move the definition to missing_threads.h like the way we define e.g.
missing syscalls or missing definitions, and include it by the users.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2023-03-06 10:04:39 +09:00
Yu Watanabe
ce16d177dd tree-wide: replace IOVEC_INIT with IOVEC_MAKE
We use gnu11 to build, hence we can use structured initializer with
casting, and it is not necessary to use different patterns on
initialization and assignment.

Addresses https://github.com/systemd/systemd/pull/26560#discussion_r1118875447.
2023-03-06 09:30:28 +09:00
Yu Watanabe
f482e22484 Merge pull request #26653 from poettering/tmpfile-linkable-replace
teach link_tmpfile() to optionally replace files
2023-03-04 02:53:59 +09:00
Lennart Poettering
23e208e742 tmpfile-util: teach link_tmpfile() to optionally replace files 2023-03-03 13:44:12 +01:00
Yu Watanabe
9f819781ca time-util: refuse non-zero gmtoff with non-UTC timezone
Also this moves the range check for gmtoff to parse_timestamp_impl(), to
address the post-merge comment:
https://github.com/systemd/systemd/pull/26409#discussion_r1118650190
2023-03-03 20:39:19 +09:00
Yu Watanabe
87e0fd575e time-util: extend comment a bit 2023-03-03 20:39:19 +09:00
Yu Watanabe
8beb47c824 time-util: rename len -> tz_offset
And merge parse_timestamp_with_tz() with parse_timestamp_impl().
Addresses the post-merge comment:
https://github.com/systemd/systemd/pull/26409#discussion_r1118647440
2023-03-03 20:39:19 +09:00
Yu Watanabe
ca9c9d8d8e time-util: fix typo
Follow-up for 7a9afae604.
2023-03-03 20:39:19 +09:00
Luca Boccassi
a41ac8ac40 Merge pull request #26628 from msizanoen1/utf8-quote-valid
escape: Ensure that output is always valid UTF-8
2023-03-02 17:33:16 +00:00
msizanoen1
0b82a6fa5d escape: add missing non-NULL parameter assertions 2023-03-02 19:55:47 +07:00
msizanoen1
00f57157f3 escape: Ensure that output is always valid UTF-8
This ensures that shell string escape operations will not produce output
with invalid UTF-8 from the input by escaping invalid UTF-8 data as if
they were single byte characters.
2023-03-02 19:55:12 +07:00
Frantisek Sumsal
8c7a6c742a virt: correctly detect QEMU emulated pSeries guests
Resolves: #26629
2023-03-01 16:52:27 +00:00
Lennart Poettering
90ec8ebe33 psi-util: fix error handling
We checked ERRNO_IS_NOT_SUPPORTED on a possible positive non-error code,
which isn't right.

Fix that. Also add caching, since we are about to call this more often.
2023-02-28 12:16:59 +00:00
Lennart Poettering
9b47b18a1a mempool: fix tile alignment check
We should check alignment *after* determining the pointer points into
our pool, not before. Otherwise might might end up checking alignment of
the pointer relative to our base, even though it is taken relative to
some other base.

Follow-up for: a2b052b29f
See: https://github.com/systemd/systemd/pull/26393#issuecomment-1442295012
2023-02-24 14:11:31 +01:00
Yu Watanabe
7a9afae604 time-util: make parse_timestamp() use the RFC-822/ISO 8601 standard timezone spec
If the timezone is specified with a number e.g. +0900 or so, then
let's parse the time as a UTC, and adjust it with the specified time
shift.

Otherwise, if an area has timezone change, e.g.
---
Africa/Casablanca  Sun Jun 17 01:59:59 2018 UT = Sun Jun 17 01:59:59 2018 +00 isdst=0 gmtoff=0
Africa/Casablanca  Sun Jun 17 02:00:00 2018 UT = Sun Jun 17 03:00:00 2018 +01 isdst=1 gmtoff=3600
Africa/Casablanca  Sun Oct 28 01:59:59 2018 UT = Sun Oct 28 02:59:59 2018 +01 isdst=1 gmtoff=3600
Africa/Casablanca  Sun Oct 28 02:00:00 2018 UT = Sun Oct 28 03:00:00 2018 +01 isdst=0 gmtoff=3600
---
then we could not determine isdst from the timezone (+01 in the above)
and mktime() will provide wrong results.

Fixes #26370.
2023-02-24 08:55:27 +09:00
Yu Watanabe
97c5f7ba1f time-util: drop unnecessary assignment of timezone name
As mktime() does not use timezone neme.
2023-02-24 08:55:27 +09:00
Yu Watanabe
a83c1baaeb time-util: rename variables
No functional changes, just refactoring.
2023-02-24 08:55:27 +09:00
Yu Watanabe
1d2c42c5dc time-util: shorten code a bit
No functional change, just refactoring.
2023-02-24 08:55:27 +09:00
Yu Watanabe
db43717e98 time-util: use usec_add() and usec_sub_unsigned()
And move the check with USEC_TIMESTAMP_FORMATTABLE_MAX at the end,
as usec_add() can handle overflow correctly.
2023-02-24 08:55:27 +09:00
Yu Watanabe
f2ecfd8bc1 time-util: use result from startswith_no_case()
No functional change, just refactoring.
2023-02-24 08:55:27 +09:00
Yu Watanabe
804537bdc4 time-util: do not use strdupa()
The input string may come from command line, config files.
2023-02-24 08:55:27 +09:00
Yu Watanabe
17d1ebfc43 time-util: drop redundant else 2023-02-24 08:55:27 +09:00
Yu Watanabe
dff3bddc54 time-util: add assertions 2023-02-24 08:55:27 +09:00
Yu Watanabe
cf98b66d1a time-util: rename variables 2023-02-24 08:55:27 +09:00
Yu Watanabe
e01a8fdd26 time-util: align string table 2023-02-24 08:55:27 +09:00
Yu Watanabe
d227a42aad time-util: use DEFINE_STRING_TABLE_LOOKUP_TO_STRING() macro 2023-02-24 08:55:27 +09:00
Yu Watanabe
7464953f33 time-util: drop redundant space 2023-02-24 08:55:27 +09:00
Yu Watanabe
6b04af6072 time-util: drop unused definition of FORMAT_TIMESTAMP_WIDTH 2023-02-24 08:55:27 +09:00
Lennart Poettering
dafb406383 shared: move cg_set_access() declaration to right header file
This function was moved from cgroup-util.c to cgroup-setup.c a while
back, but the prototype in the matching header files wasn't migrated.
Let's fix that.
2023-02-23 20:44:35 +00:00
Yu Watanabe
e47c426b5c Merge pull request #26560 from yuwata/journal-send-fix-memleak-and-cleanups
sd-journal: several fixlets and cleanups for sd_journal_send()
2023-02-23 21:37:20 +09:00
Zbigniew Jędrzejewski-Szmek
20b569a4c6 Merge pull request #26563 from dtardon/fd-init
Initialize fds with -EBADF + drop one unneeded initialization
2023-02-23 11:43:09 +01:00
Zbigniew Jędrzejewski-Szmek
a34180a22f Merge pull request #26556 from keszybz/list-timers-optimize-left
Do not say " left" on every timer in LEFT column
2023-02-23 11:37:48 +01:00
David Tardon
92651a7a2d tree-wide: initialize fds with -EBADF 2023-02-23 09:48:54 +01:00
Yu Watanabe
de5cc016b5 io-util: drop double evaluation in IOVEC_INIT_STRING()
This also makes IOVEC_INIT_STRING() and IOVEC_MAKE_STRING() identical.
2023-02-23 15:09:59 +09:00
Yu Watanabe
65e7d565e4 io-util: introduce IOVEC_NULL 2023-02-23 15:09:59 +09:00
Lennart Poettering
253a83ea44 io-util: introduce iovec_array_free()
It will be used in later commits.
2023-02-23 15:09:59 +09:00
Lennart Poettering
ff3f1464ec memory-util: add a concept for gcc cleanup attribute based array destruction 2023-02-23 11:43:43 +09:00
Lennart Poettering
a649419aae capability-util: add new capability_get_ambient() helper 2023-02-22 23:45:40 +01:00
Lennart Poettering
66c1e440c7 cap-list: add capability_set_to_string_negative() 2023-02-22 23:45:40 +01:00