mirror of
https://github.com/systemd/systemd
synced 2024-10-06 16:21:34 +00:00
udev: add upper bound of 5 hours to SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC=
Follow-up for b16c6076cb
CID#1533111
This commit is contained in:
parent
43108bf87a
commit
5af0f171f9
|
@ -253,7 +253,8 @@ All tools:
|
|||
udev manager process waits for a worker process kills slow programs specified
|
||||
by IMPORT{program}=, PROGRAM=, or RUN=, and finalizes the processing event.
|
||||
If the worker process cannot finalize the event within the specified timespan,
|
||||
the worker process is killed by the manager process. Defaults to 10 seconds.
|
||||
the worker process is killed by the manager process. Defaults to 10 seconds,
|
||||
maximum allowed is 5 hours.
|
||||
|
||||
`udevadm` and `systemd-hwdb`:
|
||||
|
||||
|
|
|
@ -335,6 +335,7 @@ static int on_event_timeout_warning(sd_event_source *s, uint64_t usec, void *use
|
|||
static usec_t extra_timeout_usec(void) {
|
||||
static usec_t saved = 10 * USEC_PER_SEC;
|
||||
static bool parsed = false;
|
||||
usec_t timeout;
|
||||
const char *e;
|
||||
int r;
|
||||
|
||||
|
@ -347,10 +348,15 @@ static usec_t extra_timeout_usec(void) {
|
|||
if (!e)
|
||||
return saved;
|
||||
|
||||
r = parse_sec(e, &saved);
|
||||
r = parse_sec(e, &timeout);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to parse $SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC=%s, ignoring: %m", e);
|
||||
|
||||
if (timeout > 5 * USEC_PER_HOUR) /* Add an arbitrary upper bound */
|
||||
log_debug("Parsed $SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC=%s is too large, ignoring.", e);
|
||||
else
|
||||
saved = timeout;
|
||||
|
||||
return saved;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue