Ouss4 commented on a change in pull request #1616:
URL: https://github.com/apache/incubator-nuttx/pull/1616#discussion_r474743103



##########
File path: tools/configure.c
##########
@@ -808,12 +851,35 @@ static void check_configured(void)
         }
       else
         {
-          fprintf(stderr, "ERROR: Found %s... Already configured\n",
-                  g_buffer);
-          fprintf(stderr, "       Please 'make distclean' and try again\n");
-          exit(EXIT_FAILURE);
+          snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig",
+                   g_configpath, g_delim);
+          defcfgpath = strdup(g_buffer);
+
+          snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig",
+                   g_topdir, g_delim);
+
+          if (filecmp(g_buffer, defcfgpath))
+            {
+              fprintf(stderr, "No configuration change.\n");
+              free(defcfgpath);
+              exit(EXIT_FAILURE);
+            }
+
+          if (g_distclean)
+            {
+              run_make("distclean");
+            }
+          else
+            {
+              fprintf(stderr, "Already configured!\n");
+              fprintf(stderr, "Please 'make distclean' and try again.\n");
+              free(defcfgpath);
+              exit(EXIT_FAILURE);
+            }
         }
     }
+
+  free(defcfgpath);

Review comment:
       I re-organized a little here to limit the frees.  Please take a look.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to