diff mbox

mke2fs: fix up topo complaints on regular files

Message ID 4B5BC395.2050805@redhat.com
State Accepted, archived
Headers show

Commit Message

Eric Sandeen Jan. 24, 2010, 3:50 a.m. UTC
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 <sandeen@redhat.com>
---


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Theodore Ts'o Feb. 6, 2010, 1:01 p.m. UTC | #1
On Sat, Jan 23, 2010 at 09:50:45PM -0600, Eric Sandeen wrote:
> 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 <sandeen@redhat.com>

Thanks, applied.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 94b4c81..81b34ab 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -47,6 +47,7 @@  extern int optind;
 #endif
 #include <sys/ioctl.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <libgen.h>
 #include <limits.h>
 #include <blkid/blkid.h>
@@ -1035,6 +1036,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)
@@ -1630,7 +1636,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"),