mirror of
https://github.com/systemd/systemd
synced 2026-04-06 23:24:52 +02:00
Compare commits
No commits in common. "39adbedafc7accbfdb0cb7f44b98d4761d7325d2" and "a45bc4a1be6973df65204f4b25518b64c358934e" have entirely different histories.
39adbedafc
...
a45bc4a1be
@ -1662,7 +1662,7 @@ int pidref_safe_fork_full(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret_pid) {
|
if (ret_pid) {
|
||||||
if (FLAGS_SET(flags, _FORK_PID_ONLY))
|
if (FLAGS_SET(flags, FORK_PID_ONLY))
|
||||||
*ret_pid = PIDREF_MAKE_FROM_PID(pid);
|
*ret_pid = PIDREF_MAKE_FROM_PID(pid);
|
||||||
else {
|
else {
|
||||||
r = pidref_set_pid(ret_pid, pid);
|
r = pidref_set_pid(ret_pid, pid);
|
||||||
@ -1840,7 +1840,7 @@ int pidref_safe_fork_full(
|
|||||||
freeze();
|
freeze();
|
||||||
|
|
||||||
if (ret_pid) {
|
if (ret_pid) {
|
||||||
if (FLAGS_SET(flags, _FORK_PID_ONLY))
|
if (FLAGS_SET(flags, FORK_PID_ONLY))
|
||||||
*ret_pid = PIDREF_MAKE_FROM_PID(getpid_cached());
|
*ret_pid = PIDREF_MAKE_FROM_PID(getpid_cached());
|
||||||
else {
|
else {
|
||||||
r = pidref_set_self(ret_pid);
|
r = pidref_set_self(ret_pid);
|
||||||
@ -1869,7 +1869,7 @@ int safe_fork_full(
|
|||||||
* a pidref to the caller. */
|
* a pidref to the caller. */
|
||||||
assert(!FLAGS_SET(flags, FORK_DETACH) || !ret_pid);
|
assert(!FLAGS_SET(flags, FORK_DETACH) || !ret_pid);
|
||||||
|
|
||||||
r = pidref_safe_fork_full(name, stdio_fds, except_fds, n_except_fds, flags|_FORK_PID_ONLY, ret_pid ? &pidref : NULL);
|
r = pidref_safe_fork_full(name, stdio_fds, except_fds, n_except_fds, flags|FORK_PID_ONLY, ret_pid ? &pidref : NULL);
|
||||||
if (r < 0 || !ret_pid)
|
if (r < 0 || !ret_pid)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|||||||
@ -187,8 +187,7 @@ typedef enum ForkFlags {
|
|||||||
FORK_NEW_NETNS = 1 << 20, /* Run child in its own network namespace 💣 DO NOT USE IN THREADED PROGRAMS! 💣 */
|
FORK_NEW_NETNS = 1 << 20, /* Run child in its own network namespace 💣 DO NOT USE IN THREADED PROGRAMS! 💣 */
|
||||||
FORK_NEW_PIDNS = 1 << 21, /* Run child in its own PID namespace 💣 DO NOT USE IN THREADED PROGRAMS! 💣 */
|
FORK_NEW_PIDNS = 1 << 21, /* Run child in its own PID namespace 💣 DO NOT USE IN THREADED PROGRAMS! 💣 */
|
||||||
FORK_FREEZE = 1 << 22, /* Don't return in child, just call freeze() instead */
|
FORK_FREEZE = 1 << 22, /* Don't return in child, just call freeze() instead */
|
||||||
|
FORK_PID_ONLY = 1 << 23, /* Don't open a pidfd referencing the child process */
|
||||||
_FORK_PID_ONLY = 1 << 23, /* Don't open a pidfd referencing the child process */
|
|
||||||
} ForkFlags;
|
} ForkFlags;
|
||||||
|
|
||||||
int pidref_safe_fork_full(
|
int pidref_safe_fork_full(
|
||||||
|
|||||||
@ -520,7 +520,7 @@ static int action_fork(char *const *_command) {
|
|||||||
/* stdio_fds= */ (const int[]) { -EBADF, -EBADF, STDERR_FILENO },
|
/* stdio_fds= */ (const int[]) { -EBADF, -EBADF, STDERR_FILENO },
|
||||||
/* except_fds= */ NULL,
|
/* except_fds= */ NULL,
|
||||||
/* n_except_fds= */ 0,
|
/* n_except_fds= */ 0,
|
||||||
/* flags= */ FORK_REARRANGE_STDIO|FORK_LOG,
|
/* flags= */ FORK_REARRANGE_STDIO,
|
||||||
&child);
|
&child);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to fork child in order to execute '%s': %m", c);
|
return log_error_errno(r, "Failed to fork child in order to execute '%s': %m", c);
|
||||||
|
|||||||
@ -118,7 +118,6 @@ int dissect_fstype_ok(const char *fstype) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_BLKID
|
|
||||||
static const char *getenv_fstype(PartitionDesignator d) {
|
static const char *getenv_fstype(PartitionDesignator d) {
|
||||||
|
|
||||||
if (d < 0 ||
|
if (d < 0 ||
|
||||||
@ -129,7 +128,6 @@ static const char *getenv_fstype(PartitionDesignator d) {
|
|||||||
char *v = strjoina("SYSTEMD_DISSECT_FSTYPE_", partition_designator_to_string(d));
|
char *v = strjoina("SYSTEMD_DISSECT_FSTYPE_", partition_designator_to_string(d));
|
||||||
return secure_getenv(ascii_strupper(v));
|
return secure_getenv(ascii_strupper(v));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int probe_sector_size(int fd, uint32_t *ret) {
|
int probe_sector_size(int fd, uint32_t *ret) {
|
||||||
|
|
||||||
|
|||||||
@ -377,7 +377,7 @@ int pidref_gethostname_full(PidRef *pidref, GetHostnameFlags flags, char **ret)
|
|||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
_cleanup_(pidref_done_sigkill_wait) PidRef child = PIDREF_NULL;
|
_cleanup_(pidref_done_sigkill_wait) PidRef child = PIDREF_NULL;
|
||||||
r = pidref_safe_fork("(sd-gethostname)", FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGKILL, &child);
|
r = pidref_safe_fork("(gethostname)", FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGKILL, &child);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user