X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Flfs_project.c;h=8471c6d6180b6794301b8766e09e8ddb82a035ff;hb=4d5a2eba617780eadf172cb5c1fc28d5ab023a97;hp=d8b150047f0f59a5711d4e5a1c226337dee982b3;hpb=f0736a6a52ed95814d2cac875caf34f7fc233bf3;p=fs%2Flustre-release.git diff --git a/lustre/utils/lfs_project.c b/lustre/utils/lfs_project.c index d8b15004..8471c6d 100644 --- a/lustre/utils/lfs_project.c +++ b/lustre/utils/lfs_project.c @@ -51,9 +51,11 @@ #include "lfs_project.h" #include +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); }