udev: use delete_trailing_chars() at one more place

This commit is contained in:
Yu Watanabe
2019-06-03 08:35:33 +09:00
parent 1b65f1ebc3
commit 7280153364
+1 -4
View File
@@ -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);