]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: replace xsprintf() + strpcpy() by strpcpyf()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 30 Apr 2019 18:35:08 +0000 (20:35 +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 8d96e8e3e2172f065756bb23a1c70298bb89b26f..97499787f5f53da17ba0ab9a38a136a6cc11cfb8 100644 (file)
@@ -234,7 +234,6 @@ static ssize_t udev_event_subst_format(
         sd_device *parent, *dev = event->dev;
         const char *val = NULL;
         char *s = dest;
-        dev_t devnum;
         int r;
 
         switch (type) {
@@ -278,13 +277,12 @@ static ssize_t udev_event_subst_format(
                 break;
         case FORMAT_SUBST_MAJOR:
         case FORMAT_SUBST_MINOR: {
-                char buf[DECIMAL_STR_MAX(unsigned)];
+                dev_t devnum;
 
                 r = sd_device_get_devnum(dev, &devnum);
                 if (r < 0 && r != -ENOENT)
                         return r;
-                xsprintf(buf, "%u", r < 0 ? 0 : type == FORMAT_SUBST_MAJOR ? major(devnum) : minor(devnum));
-                l = strpcpy(&s, l, buf);
+                l = strpcpyf(&s, l, "%u", r < 0 ? 0 : type == FORMAT_SUBST_MAJOR ? major(devnum) : minor(devnum));
                 break;
         }
         case FORMAT_SUBST_RESULT: {