Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
systemd-mini.1472
1094-udev-avoid-magic-constants-in-kernel-cmdli...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1094-udev-avoid-magic-constants-in-kernel-cmdline-parsers.patch of Package systemd-mini.1472
Based on cfe2061add5479710f6597899d632e64c54e62ef Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Wed, 5 Nov 2014 12:56:49 +0100 Subject: [PATCH] udev: avoid magic constants in kernel-cmdline parsers Lets recognize the fact that startswith() returns a pointer to the tail on success. Use it instead of hard-coding string-lengths as magic constants. --- src/udev/udevd.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- src/udev/udevd.c +++ src/udev/udevd.c 2014-11-10 12:31:15.745519116 +0000 @@ -984,7 +984,7 @@ static void kernel_cmdline_options(struc return; FOREACH_WORD_QUOTED(w, l, line, state) { - char *s, *opt; + char *s, *opt, *value; s = strndup(w, l); if (!s) @@ -996,24 +996,24 @@ static void kernel_cmdline_options(struc else opt = s; - if (startswith(opt, "udev.log-priority=")) { + if ((value = startswith(opt, "udev.log-priority="))) { int prio; - prio = util_log_priority(opt + 18); + prio = util_log_priority(value); log_set_max_level(prio); udev_set_log_priority(udev, prio); - } else if (startswith(opt, "udev.children-max=")) { - r = safe_atoi(opt + 18, &children_max); + } else if ((value = startswith(opt, "udev.children-max="))) { + r = safe_atoi(value, &children_max); if (r < 0) - log_warning("Invalid udev.children-max ignored: %s", opt + 18); - } else if (startswith(opt, "udev.exec-delay=")) { - r = safe_atoi(opt + 16, &exec_delay); + log_warning("Invalid udev.children-max ignored: %s", value); + } else if ((value = startswith(opt, "udev.exec-delay="))) { + r = safe_atoi(value, &exec_delay); if (r < 0) - log_warning("Invalid udev.exec-delay ignored: %s", opt + 16); - } else if (startswith(opt, "udev.event-timeout=")) { - r = safe_atou64(opt + 19, &event_timeout_usec); + log_warning("Invalid udev.exec-delay ignored: %s", value); + } else if ((value = startswith(opt, "udev.event-timeout="))) { + r = safe_atou64(value, &event_timeout_usec); if (r < 0) { - log_warning("Invalid udev.event-timeout ignored: %s", opt + 19); + log_warning("Invalid udev.event-timeout ignored: %s", value); break; } event_timeout_usec *= USEC_PER_SEC;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor