]> git.proxmox.com Git - mirror_lxc.git/commitdiff
tools: lxc-copy: remove the trailing . & fix coding style of strncmp
author2xsec <dh48.jeong@samsung.com>
Sun, 1 Jul 2018 13:42:27 +0000 (22:42 +0900)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 2 Jul 2018 09:13:37 +0000 (11:13 +0200)
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
src/lxc/tools/lxc_copy.c

index a76f3c680b78a5e005238b1cea4998ad32606425..33e4f9a76f4e4109adbb9c6b7343db0a39b03441 100644 (file)
@@ -187,7 +187,7 @@ int main(int argc, char *argv[])
        }
 
        if (!my_args.newname && !(my_args.task == DESTROY)) {
-               ERROR("You must provide a NEWNAME for the clone.");
+               ERROR("You must provide a NEWNAME for the clone");
                exit(ret);
        }
 
@@ -603,7 +603,7 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
                        return -1;
                break;
        case 'B':
-               if (!strncmp(arg, "overlay", strlen(arg)))
+               if (strncmp(arg, "overlay", strlen(arg)) == 0)
                        arg = "overlayfs";
                args->bdevtype = arg;
                break;
@@ -649,10 +649,10 @@ static int parse_bind_mnt(char *mntstring, enum mnttype type)
        if (len == 1) { /* bind=src */
                m->dest = construct_path(mntarray[0], false);
        } else if (len == 2) { /* bind=src:option or bind=src:dest */
-               if (!strncmp(mntarray[1], "rw", strlen(mntarray[1])))
+               if (strncmp(mntarray[1], "rw", strlen(mntarray[1])) == 0)
                        m->options = strdup("rw");
 
-               if (!strncmp(mntarray[1], "ro", strlen(mntarray[1])))
+               if (strncmp(mntarray[1], "ro", strlen(mntarray[1])) == 0)
                        m->options = strdup("ro");
 
                if (m->options)
@@ -672,8 +672,8 @@ static int parse_bind_mnt(char *mntstring, enum mnttype type)
        if (!m->options)
                m->options = strdup("rw");
 
-       if (!m->options || (strncmp(m->options, "rw", strlen(m->options)) &&
-                           strncmp(m->options, "ro", strlen(m->options))))
+       if (!m->options || (strncmp(m->options, "rw", strlen(m->options)) != 0 &&
+                           strncmp(m->options, "ro", strlen(m->options)) != 0))
                goto err;
 
        lxc_free_array((void **)mntarray, free);
@@ -771,7 +771,7 @@ static char *mount_tmpfs(const char *oldname, const char *newname,
        if (arg->tmpfs && !arg->bdevtype) {
                arg->bdevtype = "overlayfs";
        } else if (arg->tmpfs && arg->bdevtype &&
-                  strncmp(arg->bdevtype, "overlayfs", strlen(arg->bdevtype))) {
+                  strncmp(arg->bdevtype, "overlayfs", strlen(arg->bdevtype)) != 0) {
                ERROR("%s",
                      "A container can only be placed on a tmpfs when the "
                      "overlay storage driver is used");
@@ -794,7 +794,7 @@ static char *mount_tmpfs(const char *oldname, const char *newname,
                goto err_free;
 
        if (fcntl(fd, F_SETFD, FD_CLOEXEC)) {
-               ERROR("Failed to set close-on-exec on file descriptor.");
+               ERROR("Failed to set close-on-exec on file descriptor");
                goto err_close;
        }