From: Eric Sandeen Date: Sun, 24 Jan 2010 03:50:45 +0000 (-0600) Subject: mke2fs: fix up topo complaints on regular files X-Git-Tag: v1.41.10~1 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=13b0b1231ed28aac75ba336de7a8cb3b4611ce68;p=tools%2Fe2fsprogs.git mke2fs: fix up topo complaints on regular files mkfsing a plain file would lead to a warning about being unable to determine geometry; we should just skip the topology-getting if we see that we have a regular file. This was breaking "make check" but I had missed it since I inadvertently stopped running the checks during the Fedora RPM build. Also, add a newline to the warning. Signed-off-by: Eric Sandeen Signed-off-by: "Theodore Ts'o" --- diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 80b9c0b..b386f65 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -47,6 +47,7 @@ extern int optind; #endif #include #include +#include #include #include #include @@ -1091,6 +1092,11 @@ static int ext2fs_get_device_geometry(const char *file, blkid_topology tp; unsigned long min_io; unsigned long opt_io; + struct stat statbuf; + + /* Nothing to do for a regular file */ + if (!stat(file, &statbuf) && S_ISREG(statbuf.st_mode)) + return 0; pr = blkid_new_probe_from_filename(file); if (!pr) @@ -1681,7 +1687,7 @@ got_size: retval = ext2fs_get_device_geometry(device_name, &fs_param); if (retval < 0) { fprintf(stderr, - _("warning: Unable to get device geometry for %s"), + _("warning: Unable to get device geometry for %s\n"), device_name); } else if (retval) { printf(_("%s alignment is offset by %lu bytes.\n"),