diff --git a/ChangeLog b/ChangeLog
index 8dd51f8cc218106f877f985be8a929fa46e8f415..1942c631a86ef92c5ad7000e57dedb15798f69a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-04-21  David Lawrence Ramsey  <pooka109@gmail.com>
 
+	* files.c (do_writeout): If we're in restricted mode, we're not
+	allowed to write selections to files, so don't display the
+	"Write Selection to File" prompt.
 	* files.c (do_writeout): Simplify.
 
 2007-04-19  David Lawrence Ramsey  <pooka109@gmail.com>
diff --git a/src/files.c b/src/files.c
index 5e07880a080126dca50691847c03c819d241560e..adbd8e65789187dafd82939f9726c82574b37721 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1796,7 +1796,11 @@ bool do_writeout(bool exiting)
 
 	backupstr = ISSET(BACKUP_FILE) ? _(" [Backup]") : "";
 
-	if (!exiting && openfile->mark_set)
+	/* If we're using restricted mode, don't display the "Write
+	 * Selection to File" prompt.  This is disabled, since it allows
+	 * reading from or writing to files not specified on the command
+	 * line. */
+	if (!ISSET(RESTRICTED) && !exiting && openfile->mark_set)
 	    msg = (append == PREPEND) ?
 		_("Prepend Selection to File") : (append == APPEND) ?
 		_("Append Selection to File") :