Commit Graph

6 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 536970d4f9 hostnamed: minor style cleanups 2020-12-16 11:02:18 +01:00
Zbigniew Jędrzejewski-Szmek 39ede7cc37 shared/hostname-setup: leave the terminator byte alone
gethostname(3) says it's unspecified whether the string is properly terminated
when the hostname is too long. We created a buffer with one extra byte, and it
seems the intent was to let that byte serve as terminator even if we get an
unterminated string from gethostname().
2020-12-16 11:02:17 +01:00
Zbigniew Jędrzejewski-Szmek b6fad30665 shared/hostname-setup: add mode where we check what would be set, without doing
This allows the 'unsafe' mark to be removed from the test.
2020-12-16 11:02:17 +01:00
Zbigniew Jędrzejewski-Szmek e2054217d5 Move hostname setup logic to new shared/hostname-setup.[ch]
No functional change, just moving a bunch of things around. Before
we needed a rather complicated setup to test hostname_setup(), because
the code was in src/core/. When things are moved to src/shared/
we can just test it as any function.

The test is still "unsafe" because hostname_setup() may modify the
hostname.
2020-12-16 11:02:15 +01:00
Lennart Poettering 4d89613917 hostname-setup: move to core/ 2012-04-12 14:23:17 +02:00
Kay Sievers f33d3ec1d7 move more common files to shared/ and add them to shared.la 2012-04-12 02:39:37 +02:00
Renamed from src/hostname-setup.c (Browse further)