public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix xfs_fsr so the temp dir is not world readable/writable
@ 2007-04-19  3:10 Barry Naujok
  2007-04-19  3:42 ` Nathan Scott
  0 siblings, 1 reply; 2+ messages in thread
From: Barry Naujok @ 2007-04-19  3:10 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: Type: text/plain, Size: 107 bytes --]

Just changed the ".fsr" directory to 0700.
I also improved the usage text to give more information.

Barry.

[-- Attachment #2: xfs_fsr.patch --]
[-- Type: application/octet-stream, Size: 2282 bytes --]

--- a/xfsdump/fsr/xfs_fsr.c	2007-04-19 13:02:03.000000000 +1000
+++ b/xfsdump/fsr/xfs_fsr.c	2007-04-19 12:38:32.935322710 +1000
@@ -19,7 +19,7 @@
 /*
  * fsr - file system reorganizer
  *
- * fsr [-d] [-v] [-n] [-s] [-g] [-t mins] [-f leftf] [-m mtab]
+ * fsr [-d] [-v] [-n] [-s] [-g] [-t secs] [-f leftf] [-m mtab]
  * fsr [-d] [-v] [-n] [-s] [-g] xfsdev | dir | file ...
  *
  * If invoked in the first form fsr does the following: starting with the
@@ -100,7 +100,7 @@ static __int64_t	minimumfree = 2048;
 static time_t howlong = 7200;		/* default seconds of reorganizing */
 static char *leftofffile = "/var/tmp/.fsrlast_xfs";/* where we left off last */
 static char *mtab = MOUNTED;
-static time_t endtime;
+static time_t endtime = 0;
 static time_t starttime;
 static xfs_ino_t	leftoffino = 0;
 static int	pagesize;
@@ -358,7 +358,21 @@ main(int argc, char **argv)
 void
 usage(int ret)
 {
-	fprintf(stderr, _("Usage: %s [xfsfile] ...\n"), progname);
+	fprintf(stderr, _(
+"Usage: %s [-d] [-v] [-n] [-s] [-g] [-t time] [-p passes] [-f leftf] [-m mtab]\n"
+"       %s [-d] [-v] [-n] [-s] [-g] xfsdev | dir | file ...\n\n"
+"Options:\n"
+"       -n              Do nothing, only interesting with -v. Not\n"
+"                       effective with in mtab mode.\n"
+"       -s		Print statistics only.\n"
+"       -g              Print to syslog (default if stdout not a tty).\n"
+"       -t time         How long to run in seconds.\n"
+"       -p passes	Number of passes before terminating global re-org.\n"
+"       -f leftoff      Use this instead of /etc/fsrlast.\n"
+"       -m mtab         Use something other than /etc/mtab.\n"
+"       -d              Debug, print even more.\n"
+"       -v		Verbose, more -v's more verbose.\n"
+		), progname, progname);
 	exit(ret);
 }
 
@@ -915,7 +929,7 @@ fsrfile_common(
 	}
 	if (fsx.fsx_xflags & XFS_XFLAG_NODEFRAG) {
 		if (vflag)
-			fsrprintf(_("%s: marked as don't defrag, ignoring\n"), 
+			fsrprintf(_("%s: marked as don't defrag, ignoring\n"),
 			    fname);
 		return(0);
 	}
@@ -1533,7 +1547,7 @@ tmp_init(char *mnt)
 	sprintf(buf, "%s/.fsr", mnt);
 
 	mask = umask(0);
-	if (mkdir(buf, 0777) < 0) {
+	if (mkdir(buf, 0700) < 0) {
 		if (errno == EEXIST) {
 			if (dflag)
 				fsrprintf(_("tmpdir already exists: %s\n"),

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix xfs_fsr so the temp dir is not world readable/writable
  2007-04-19  3:10 [PATCH] Fix xfs_fsr so the temp dir is not world readable/writable Barry Naujok
@ 2007-04-19  3:42 ` Nathan Scott
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Scott @ 2007-04-19  3:42 UTC (permalink / raw)
  To: Barry Naujok; +Cc: xfs

On Thu, 2007-04-19 at 13:10 +1000, Barry Naujok wrote:
> 

Looks good.

> -static time_t endtime;
> +static time_t endtime = 0; 

This line of the change is unnecessary though.

cheers.

-- 
Nathan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-19  3:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-19  3:10 [PATCH] Fix xfs_fsr so the temp dir is not world readable/writable Barry Naujok
2007-04-19  3:42 ` Nathan Scott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox