summaryrefslogtreecommitdiffstats
path: root/toolbox/newfs_msdos.c
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-01-05 13:49:11 -0800
committerSan Mehat <san@google.com>2010-01-05 13:49:11 -0800
commitff3bcd03079d9e0e94f70955370f3eb940d6244a (patch)
tree8d80914b2fc2b28395f63f98212153386f0e0fae /toolbox/newfs_msdos.c
parent37c71dd9a7f488563c97fdca88cca701e2962e45 (diff)
downloadcore-ff3bcd03079d9e0e94f70955370f3eb940d6244a.tar.gz
core-ff3bcd03079d9e0e94f70955370f3eb940d6244a.tar.bz2
core-ff3bcd03079d9e0e94f70955370f3eb940d6244a.zip
toolbox: newfs_msdos: If geometry is not available, use some sane-ish defaults
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'toolbox/newfs_msdos.c')
-rw-r--r--toolbox/newfs_msdos.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/toolbox/newfs_msdos.c b/toolbox/newfs_msdos.c
index 4483cc053..779150e6c 100644
--- a/toolbox/newfs_msdos.c
+++ b/toolbox/newfs_msdos.c
@@ -811,20 +811,21 @@ getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag,
struct hd_geometry geom;
if (ioctl(fd, BLKSSZGET, &bpb->bps)) {
- fprintf(stderr, "Error getting bytes / sector (%s)", strerror(errno));
+ fprintf(stderr, "Error getting bytes / sector (%s)\n", strerror(errno));
exit(1);
}
ckgeom(fname, bpb->bps, "bytes/sector");
if (ioctl(fd, BLKGETSIZE, &bpb->bsec)) {
- fprintf(stderr, "Error getting blocksize (%s)", strerror(errno));
+ fprintf(stderr, "Error getting blocksize (%s)\n", strerror(errno));
exit(1);
}
if (ioctl(fd, HDIO_GETGEO, &geom)) {
- fprintf(stderr, "Error getting gemoetry (%s)", strerror(errno));
- exit(1);
+ fprintf(stderr, "Error getting gemoetry (%s) - trying sane values\n", strerror(errno));
+ geom.heads = 64;
+ geom.sectors = 63;
}
bpb->spt = geom.sectors;