static __int64_t
getdisksize(int fd, const char *fname)
{
- //struct diskslices ds;
- struct disklabel dl, *lp;
- const char *s1, *s2;
- char *s;
- int slice, part, fd1, i, e;
+ //struct diskslices ds;
+ struct disklabel dl, *lp;
+ const char *s1, *s2;
+ char *s;
+ int slice, part, fd1, i, e;
__int64_t size = 0LL;
slice = part = -1;
if (i == -1 && slice != -1 && part == -1) {
e = errno;
if (!(s = strdup(fname))) {
- fprintf(stderr, "%s: %s\n",
+ fprintf(stderr, "%s: %s\n",
progname, strerror(errno));
exit(1);
}
exit(1);
}
size = lp->d_partitions[part].p_size;
- }
+ }
}
return size;
}
int fd;
struct stat st;
__int64_t size;
-
+
/* Test to see if we are dealing with a regular file rather than a
* block device, if we are just use the size returned by stat64
*/
}
size = getdisksize(fd, path);
-
+
close(fd);
return size;