1
0
mirror of https://github.com/systemd/systemd synced 2025-09-28 16:24:45 +02:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Yu Watanabe
4dbc0be2e5 udev/cdrom_id: re-enable logging related functions
The logging related functions are mistakenly located in main() by
a084b3878955bc1b93adcaa7a41acb83b18eff9b, and dropped by
23afa884d4f3bcd97160a893816f9ba170f62ad4.
2021-01-20 18:31:10 +00:00
Yu Watanabe
888f65ace6 path-util: simplify check_x_access()
Follow-up for ece852c84592220c3d6bb5a055fd8b84ea097290.

This addresses the following comments by the Lennart:
---
hmm, so this now does two access() calls for the case where the fd is
not requested, and opens things up for races (theoretically, …). now,
the access() code path was in place for optimization, but if an optimization
is less sexy than the original (and i think it is less sexy, since more
than one syscall, and non-atomic), i think we shouldn't do the optimization.

maybe we should just always use open(O_PATH) now, and then fstat() it to
check if regular file, and then access_fd() it for checking if its executable.
2021-01-20 17:43:36 +01:00
Luca Boccassi
aac5fbff0b sysext: install in rootbindir, remove template from unit
This reverts commit 71ad75f30641b90f9ca0088869f164d9d085430f.
2021-01-20 15:25:03 +01:00
5 changed files with 21 additions and 28 deletions

View File

@ -2212,7 +2212,7 @@ if conf.get('ENABLE_SYSEXT') == 1
link_with : [libshared],
install_rpath : rootlibexecdir,
install : true,
install_dir : rootlibexecdir)
install_dir : rootbindir)
endif
if conf.get('ENABLE_USERDB') == 1

View File

@ -587,34 +587,22 @@ char* path_join_internal(const char *first, ...) {
static int check_x_access(const char *path, int *ret_fd) {
_cleanup_close_ int fd = -1;
const char *with_dash;
int r;
if (ret_fd) {
/* We need to use O_PATH because there may be executables for which we have only exec
* permissions, but not read (usually suid executables). */
fd = open(path, O_PATH|O_CLOEXEC);
if (fd < 0)
return -errno;
r = access_fd(fd, X_OK);
if (r < 0)
return r;
} else {
/* Let's optimize things a bit by not opening the file if we don't need the fd. */
if (access(path, X_OK) < 0)
return -errno;
}
with_dash = strjoina(path, "/");
/* If this passes, it must be a directory. */
if (access(with_dash, X_OK) >= 0)
return -EISDIR;
if (errno != ENOTDIR)
/* We need to use O_PATH because there may be executables for which we have only exec
* permissions, but not read (usually suid executables). */
fd = open(path, O_PATH|O_CLOEXEC);
if (fd < 0)
return -errno;
r = fd_verify_regular(fd);
if (r < 0)
return r;
r = access_fd(fd, X_OK);
if (r < 0)
return r;
if (ret_fd)
*ret_fd = TAKE_FD(fd);

View File

@ -948,6 +948,11 @@ static int run(int argc, char *argv[]) {
_cleanup_(context_clear) Context c;
int r;
log_set_target(LOG_TARGET_AUTO);
udev_parse_config();
log_parse_environment();
log_open();
context_init(&c);
r = parse_argv(argc, argv);

View File

@ -133,6 +133,7 @@ units = [
['systemd-poweroff.service', ''],
['systemd-reboot.service', ''],
['systemd-rfkill.socket', 'ENABLE_RFKILL'],
['systemd-sysext.service', 'ENABLE_SYSEXT'],
['systemd-sysusers.service', 'ENABLE_SYSUSERS',
'sysinit.target.wants/'],
['systemd-tmpfiles-clean.service', 'ENABLE_TMPFILES'],
@ -211,7 +212,6 @@ in_units = [
['systemd-oomd.service', 'ENABLE_OOMD'],
['systemd-portabled.service', 'ENABLE_PORTABLED',
'dbus-org.freedesktop.portable1.service'],
['systemd-sysext.service', 'ENABLE_SYSEXT'],
['systemd-userdbd.service', 'ENABLE_USERDB'],
['systemd-homed.service', 'ENABLE_HOMED'],
['systemd-quotacheck.service', 'ENABLE_QUOTACHECK'],

View File

@ -24,8 +24,8 @@ ConditionDirectoryNotEmpty=|/usr/lib/extensions
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=@rootlibexecdir@/systemd-sysext --merge
ExecStop=@rootlibexecdir@/systemd-sysext --unmerge
ExecStart=systemd-sysext --merge
ExecStop=systemd-sysext --unmerge
[Install]
WantedBy=sysinit.target