stripe_count_arg = argv[4];
optind = 4;
} else {
+ optind = 0;
while ((c = getopt_long(argc, argv, "c:di:s:",
- long_opts, NULL)) >= 0)
- {
+ long_opts, NULL)) >= 0) {
switch (c) {
case 0:
/* Long options. */
time(&t);
+ optind = 0;
while ((c = getopt_long_only(argc, argv, "-A:C:D:M:n:PpO:qrs:t:v",
long_opts, NULL)) >= 0) {
xtime = NULL;
long long avail, used, total;
double ratio = 0;
char *suffix = "KMGTPEZY";
- char tbuf[10], ubuf[10], abuf[10], rbuf[10];
+ /* Note if we have >2^64 bytes/fs these buffers will need to be grown */
+ char tbuf[20], ubuf[20], abuf[20], rbuf[20];
if (!uuid || !stat)
return -EINVAL;
FILE *fp;
char *path = NULL;
struct mntent *mnt = NULL;
- char mntdir[PATH_MAX] = {'\0'};
+ char *mntdir = NULL;
int ishow = 0, cooked = 0;
int c, rc = 0;
argv[0], MOUNTED, strerror(errno));
return rc;
}
+
+ if ((mntdir = malloc(PATH_MAX)) == NULL) {
+ fprintf(stderr, "error: cannot allocate %d bytes\n",
+ PATH_MAX);
+ return -ENOMEM;
+ }
+ memset(mntdir, 0, PATH_MAX);
+
if (path) {
- rc = path2mnt(path, fp, mntdir, sizeof(mntdir));
+ rc = path2mnt(path, fp, mntdir, PATH_MAX);
if (rc) {
endmntent(fp);
+ free(mntdir);
return rc;
}
endmntent(fp);
}
+ free(mntdir);
return rc;
}
int c,rc;
int flag = 0;
+ optind = 0;
while ((c = getopt(argc, argv, "i")) != -1) {
switch (c) {
case 'i':