PERFORCE change 84582 for review

Scott Long scottl at FreeBSD.org
Fri Sep 30 14:55:49 PDT 2005


http://perforce.freebsd.org/chv.cgi?CH=84582

Change 84582 by scottl at scottl-junior on 2005/09/30 21:55:43

	Correct some faulty logic.

Affected files ...

.. //depot/projects/soc2005/ufsj/src/sbin/tunefs/tunefs.c#6 edit

Differences ...

==== //depot/projects/soc2005/ufsj/src/sbin/tunefs/tunefs.c#6 (text+ko) ====

@@ -75,6 +75,11 @@
 void usage(void);
 void printfs(void);
 
+/*
+ * Create a valid journal file.
+ * XXX This is just a hack at the moment.  The real version will generate the
+ * appropriate metadata instead of relying on the FS to do it.
+ */
 ino_t
 create_journal(void)
 {
@@ -88,15 +93,12 @@
 	args.fspec = (void *)disk.d_name;
 	if (mount("ufs", "/mnt", 0, &args) < 0)
 		err(1, "%s", disk.d_name);
-	if (stat("/mnt/.jounal", &sb) == 0) {
-		unlink("/mnt/.journal");
-	}
 
 	if (statfs("/mnt", &fs) < 0)
 		err(1, "%s", disk.d_name);
 	jblocks = fs.f_blocks * .01;
 
-	fd = open("/mnt/.journal", O_RDWR | O_CREAT);
+	fd = open("/mnt/.journal", O_RDWR | O_CREAT | O_TRUNC);
 	if (fd < 0)
 		err(1, "%s", disk.d_name);
 


More information about the p4-projects mailing list