diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index d08c4ce..9a6b2f3 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -242,8 +242,8 @@ function system_themes_page() {
 /**
  * Form to select the administration theme.
  *
- * @ingroup forms
  * @see system_themes_admin_form_submit()
+ * @ingroup forms
  */
 function system_themes_admin_form($form, &$form_state, $theme_options) {
   // Administration theme settings.
@@ -376,10 +376,12 @@ function system_theme_default() {
  *
  * @param $key
  *   A theme name.
+ *
  * @return
  *   The form structure.
- * @ingroup forms
+ *
  * @see system_theme_settings_submit()
+ * @ingroup forms
  */
 function system_theme_settings($form, &$form_state, $key = '') {
   // Default settings are defined in theme_get_setting() in includes/theme.inc
@@ -782,9 +784,9 @@ function _system_is_incompatible(&$incompatible, $files, $file) {
  * @return
  *   The form array.
  *
- * @ingroup forms
  * @see theme_system_modules()
  * @see system_modules_submit()
+ * @ingroup forms
  */
 function system_modules($form, $form_state = array()) {
   // Get current list of modules.
@@ -1231,13 +1233,15 @@ function system_modules_submit($form, &$form_state) {
 /**
  * Builds a form of currently disabled modules.
  *
- * @ingroup forms
- * @see system_modules_uninstall_validate()
- * @see system_modules_uninstall_submit()
  * @param $form_state['values']
  *   Submitted form values.
+ *
  * @return
  *   A form array representing the currently disabled modules.
+ *
+ * @see system_modules_uninstall_validate()
+ * @see system_modules_uninstall_submit()
+ * @ingroup forms
  */
 function system_modules_uninstall($form, $form_state = NULL) {
   // Make sure the install API is available.
@@ -1373,8 +1377,8 @@ function system_modules_uninstall_submit($form, &$form_state) {
 /**
  * Form builder; The general site information form.
  *
- * @ingroup forms
  * @see system_settings_form()
+ * @ingroup forms
  */
 function system_site_information_settings($form, &$form_state) {
   $site_config = config('system.site');
@@ -1561,8 +1565,8 @@ function system_run_cron_submit($form, &$form_state) {
 /**
  * Form builder; Configure error reporting settings.
  *
- * @ingroup forms
  * @see system_logging_settings_submit()
+ * @ingroup forms
  */
 function system_logging_settings($form, &$form_state) {
   $form['error_level'] = array(
@@ -1595,8 +1599,8 @@ function system_logging_settings_submit($form, &$form_state) {
 /**
  * Form builder; Configure site performance settings.
  *
- * @ingroup forms
  * @see system_performance_settings_submit().
+ * @ingroup forms
  */
 function system_performance_settings($form, &$form_state) {
   drupal_add_library('system', 'drupal.system');
@@ -1720,17 +1724,22 @@ function system_clear_page_cache_submit($form, &$form_state) {
 /**
  * Form builder; Configure the site file handling.
  *
- * @ingroup forms
  * @see system_settings_form()
+ * @see system_file_system_settings_validate()
+ * @see system_file_system_settings_submit()
+ * @ingroup forms
  */
 function system_file_system_settings() {
+  $form = array(
+    '#validate' => array('system_file_system_settings_validate'),
+    '#submit' => array('system_file_system_settings_submit'),
+  );
   $form['file_public_path'] = array(
     '#type' => 'textfield',
     '#title' => t('Public file system path'),
     '#default_value' => variable_get('file_public_path', conf_path() . '/files'),
     '#maxlength' => 255,
     '#description' => t('A local file system path where public files will be stored. This directory must exist and be writable by Drupal. This directory must be relative to the Drupal installation directory and be accessible over the web.'),
-    '#after_build' => array('system_check_directory'),
   );
 
   $form['file_private_path'] = array(
@@ -1739,7 +1748,6 @@ function system_file_system_settings() {
     '#default_value' => variable_get('file_private_path', ''),
     '#maxlength' => 255,
     '#description' => t('An existing local file system path for storing private files. It should be writable by Drupal and not accessible over the web. See the online handbook for <a href="@handbook">more information about securing private files</a>.', array('@handbook' => 'http://drupal.org/documentation/modules/file')),
-    '#after_build' => array('system_check_directory'),
   );
 
   $form['file_temporary_path'] = array(
@@ -1748,7 +1756,6 @@ function system_file_system_settings() {
     '#default_value' => variable_get('file_temporary_path', file_directory_temp()),
     '#maxlength' => 255,
     '#description' => t('A local file system path where temporary files will be stored. This directory should not be accessible over the web.'),
-    '#after_build' => array('system_check_directory'),
   );
   // Any visible, writeable wrapper can potentially be used for the files
   // directory, including a remote file system that integrates with a CDN.
@@ -1770,10 +1777,42 @@ function system_file_system_settings() {
 }
 
 /**
+ * Form validation handler for the system_file_system_settings() form.
+ *
+ * @see system_file_system_settings_submit().
+ */
+function system_file_system_settings_validate($form, &$form_state) {
+  $resolved_public_path = realpath($form['file_public_path']['#value']);
+  $resolved_private_path = realpath($form['file_private_path']['#value']);
+  $resolved_temporary_path = realpath($form['file_temporary_path']['#value']);
+
+  if ($resolved_public_path == $resolved_private_path) {
+    form_set_error('file_private_path', t('The private file system path must not be the same as the public file system path.'));
+  }
+
+  if ($resolved_public_path == $resolved_temporary_path) {
+    form_set_error('file_temporary_path', t('The temporary directory must not be the same as the public file system path.'));
+  }
+}
+
+/**
+ * Form submission handler for the system_file_system_settings() form.
+ *
+ * Verify public, private, and temporary paths exist, or can be created.
+ *
+ * @see system_file_system_settings_validate()
+ */
+function system_file_system_settings_submit($form, &$form_state) {
+  system_check_directory($form['file_public_path'], FALSE);
+  system_check_directory($form['file_private_path'], TRUE);
+  system_check_directory($form['file_temporary_path'], TRUE);
+}
+
+/**
  * Form builder; Configure site image toolkit usage.
  *
- * @ingroup forms
  * @see system_settings_form()
+ * @ingroup forms
  */
 function system_image_toolkit_settings() {
   $toolkits_available = image_get_available_toolkits();
@@ -1859,9 +1898,9 @@ function system_rss_feeds_settings_submit($form, &$form_state) {
 /**
  * Form builder; Configure the site regional settings.
  *
- * @ingroup forms
  * @see system_settings_form()
  * @see system_regional_settings_submit()
+ * @ingroup forms
  */
 function system_regional_settings() {
   $countries = country_get_list();
@@ -1944,8 +1983,8 @@ function system_regional_settings() {
 /**
  * Form builder; Configure the site date and time settings.
  *
- * @ingroup forms
  * @see system_settings_form()
+ * @ingroup forms
  */
 function system_date_time_settings() {
   // Get list of all available date types.
@@ -2146,8 +2185,8 @@ function system_add_date_format_type_form_submit($form, &$form_state) {
 /**
  * Form builder; Configure the site's maintenance status.
  *
- * @ingroup forms
  * @see system_site_maintenance_mode_submit()
+ * @ingroup forms
  */
 function system_site_maintenance_mode($form, &$form_state) {
   $config = config('system.maintenance');
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 950fee6..5799c8f 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -2662,10 +2662,13 @@ function system_admin_menu_block($item) {
  * This function is called from the system_settings form to check all core
  * file directories (file_public_path, file_private_path, file_temporary_path).
  *
- * @param $form_element
+ * @param array $form_element
  *   The form element containing the name of the directory to check.
+ * @param boolean $private
+ *   (optional) If $private is TRUE, create an .htaccess file configured for
+ *   secure access in the directory specified by $form_element.
  */
-function system_check_directory($form_element) {
+function system_check_directory($form_element, $private = TRUE) {
   $directory = $form_element['#value'];
   if (strlen($directory) == 0) {
     return $form_element;
@@ -2683,14 +2686,7 @@ function system_check_directory($form_element) {
     watchdog('file system', 'The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory), WATCHDOG_ERROR);
   }
   elseif (is_dir($directory)) {
-    if ($form_element['#name'] == 'file_public_path') {
-      // Create public .htaccess file.
-      file_save_htaccess($directory, FALSE);
-    }
-    else {
-      // Create private .htaccess file.
-      file_save_htaccess($directory);
-    }
+    file_save_htaccess($directory, $private);
   }
 
   return $form_element;
