Whamcloud - gitweb
LU-14093 utils: trivial changes to support gcc10 85/40485/6
authorAlex Zhuravlev <bzzz@whamcloud.com>
Fri, 30 Oct 2020 06:48:27 +0000 (09:48 +0300)
committerOleg Drokin <green@whamcloud.com>
Sat, 10 Apr 2021 17:39:53 +0000 (17:39 +0000)
just to fix gcc10 complains.

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I8390d28fe78c9dad15a41301cc2b6d6184fdc330
Reviewed-on: https://review.whamcloud.com/40485
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/utils/lfs_project.c
lustre/utils/lfs_project.h
lustre/utils/mkfs_lustre.c
lustre/utils/mount_utils.h

index d8b1500..8471c6d 100644 (file)
 #include "lfs_project.h"
 #include <lustre/lustreapi.h>
 
+const char     *progname;
+
 struct lfs_project_item {
        struct list_head lpi_list;
-       char lpi_pathname[PATH_MAX];
+       char *lpi_pathname;
 };
 
 static int
@@ -69,8 +71,12 @@ lfs_project_item_alloc(struct list_head *head, const char *pathname)
                return -ENOMEM;
        }
 
-       strncpy(lpi->lpi_pathname, pathname, sizeof(lpi->lpi_pathname) - 1);
-       list_add_tail(&lpi->lpi_list, head);
+       lpi->lpi_pathname = strdup(pathname);
+       if (!lpi->lpi_pathname) {
+               free(lpi);
+               return -ENOMEM;
+       } else
+               list_add_tail(&lpi->lpi_list, head);
 
        return 0;
 }
@@ -334,6 +340,7 @@ static int lfs_project_iterate(const char *pathname,
                                             phc, func);
                if (!ret && rc)
                        ret = rc;
+               free(lpi->lpi_pathname);
                free(lpi);
        }
 
index 66404ca..01310a9 100644 (file)
@@ -36,7 +36,7 @@
 #include <stdbool.h>
 #include <linux/types.h>
 
-const char     *progname;
+extern const char      *progname;
 
 enum lfs_project_ops_t {
        LFS_PROJECT_CHECK       = 0,
index 153a466..75979b9 100644 (file)
@@ -271,7 +271,7 @@ static inline void badopt(const char *opt, char *type)
 static int erase_param(const char *const buf, const char *const param,
                       bool withval)
 {
-       char    search[PARAM_MAX + 1] = "";
+       char    search[PARAM_MAX + 8] = "";
        char    *buffer = (char *)buf;
        bool    found = false;
 
index b473e01..d7e4f6e 100644 (file)
@@ -250,8 +250,8 @@ struct module_backfs_ops {
        void   *dl_handle;
 };
 
-struct module_backfs_ops zfs_ops;
-struct module_backfs_ops ldiskfs_ops;
+extern struct module_backfs_ops zfs_ops;
+extern struct module_backfs_ops ldiskfs_ops;
 
 struct module_backfs_ops *load_backfs_module(enum ldd_mount_type mount_type);
 void unload_backfs_ops(struct module_backfs_ops *ops);