mount: rename tmp variables in the mount_add_list()
authorRafał Miłecki <rafal@milecki.pl>
Fri, 16 Feb 2018 14:32:26 +0000 (15:32 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Fri, 16 Feb 2018 14:33:40 +0000 (15:33 +0100)
Both of them are used once only so there is no real need for the tmp(2)
variables. We can just name them nicer to make code easier to read.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
mount.c

diff --git a/mount.c b/mount.c
index bf5fbfdd2fdeaba22b6f6e1aee49b29bdb63c35c..f2c15a0a16a9d4c99f1bc5a601fe32f4566b5783 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -152,7 +152,7 @@ static void mount_add_list(char *name, char *dev, char *serial,
        char *vendor, char *model, char *rev, int ignore, char *size, char *sector_size, int fs)
 {
        struct mount *mount;
-       char tmp[64], tmp2[64];
+       char dev_path[64], dev_link[64];
 
        mount  = malloc(sizeof(struct mount));
        INIT_LIST_HEAD(&mount->list);
@@ -172,9 +172,9 @@ static void mount_add_list(char *name, char *dev, char *serial,
                mount->status = STATUS_IGNORE;
        } else {
                log_printf("new mount : %s -> %s (%s)\n", name, dev, fs_names[mount->fs]);
-               snprintf(tmp, 64, "%s%s", uci_path, name);
-               snprintf(tmp2, 64, "/tmp/run/mountd/%s", dev);
-               symlink(tmp2, tmp);
+               snprintf(dev_link, sizeof(dev_link), "%s%s", uci_path, name);
+               snprintf(dev_path, sizeof(dev_path), "%s%s", "/tmp/run/mountd/", dev);
+               symlink(dev_path, dev_link);
                if (!mount_new("/tmp/run/mountd/", dev))
                        system_printf("ACTION=add DEVICE=%s NAME=%s /sbin/hotplug-call mount", dev, name);
        }