diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index 97499787f5..817648ec93 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -334,7 +334,6 @@ static ssize_t udev_event_subst_format( } case FORMAT_SUBST_ATTR: { char vbuf[UTIL_NAME_SIZE]; - size_t len; int count; if (isempty(attr)) @@ -358,9 +357,7 @@ static ssize_t udev_event_subst_format( /* strip trailing whitespace, and replace unwanted characters */ if (val != vbuf) strscpy(vbuf, sizeof(vbuf), val); - len = strlen(vbuf); - while (len > 0 && isspace(vbuf[--len])) - vbuf[len] = '\0'; + delete_trailing_chars(vbuf, NULL); count = util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); if (count > 0) log_device_debug(dev, "%i character(s) replaced", count);