Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-17504 build: fix array-index-out-of-bounds warning
[fs/lustre-release.git]
/
lustre
/
utils
/
liblustreapi_util.c
diff --git
a/lustre/utils/liblustreapi_util.c
b/lustre/utils/liblustreapi_util.c
index
9cb9c45
..
ceab7a4
100644
(file)
--- a/
lustre/utils/liblustreapi_util.c
+++ b/
lustre/utils/liblustreapi_util.c
@@
-342,6
+342,7
@@
int llapi_rmfid(const char *path, struct fid_array *fa)
}
rc = llapi_rmfid_at(rootfd, fa);
}
rc = llapi_rmfid_at(rootfd, fa);
+ close(rootfd);
if (rc < 0) {
fprintf(stderr, "lfs rmfid: cannot remove FIDs: %s\n",
strerror(-rc));
if (rc < 0) {
fprintf(stderr, "lfs rmfid: cannot remove FIDs: %s\n",
strerror(-rc));
@@
-362,10
+363,15
@@
int llapi_direntry_remove(char *dname)
int rc = 0;
dirpath = strdup(dname);
int rc = 0;
dirpath = strdup(dname);
- namepath = strdup(dname);
- if (!dirpath || !namepath)
+ if (!dirpath)
return -ENOMEM;
return -ENOMEM;
+ namepath = strdup(dname);
+ if (!namepath) {
+ rc = -ENOMEM;
+ goto out_dirpath;
+ }
+
filename = basename(namepath);
dir = dirname(dirpath);
filename = basename(namepath);
dir = dirname(dirpath);
@@
-383,10
+389,10
@@
int llapi_direntry_remove(char *dname)
"error on ioctl %#lx for '%s' (%d)",
(long)LL_IOC_LMV_SETSTRIPE, filename, fd);
out:
"error on ioctl %#lx for '%s' (%d)",
(long)LL_IOC_LMV_SETSTRIPE, filename, fd);
out:
-
free(dirpath
);
+
close(fd
);
free(namepath);
free(namepath);
- if (fd != -1)
-
close(fd
);
+out_dirpath:
+
free(dirpath
);
return rc;
#else
return -EOPNOTSUPP;
return rc;
#else
return -EOPNOTSUPP;