]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: use delete_trailing_chars() at one more place
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 30 Apr 2019 19:01:44 +0000 (21:01 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 2 Jun 2019 23:35:33 +0000 (08:35 +0900)
src/udev/udev-event.c

index 97499787f5f53da17ba0ab9a38a136a6cc11cfb8..817648ec93f0695007cd1e86b0568871b224d4d8 100644 (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);