[Midnightbsd-cvs] src [7093] trunk/lib/libmport/delete_primative.c: refactor to print a friendly message if the files do not match

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Jul 15 08:08:27 EDT 2015


Revision: 7093
          http://svnweb.midnightbsd.org/src/?rev=7093
Author:   laffer1
Date:     2015-07-15 08:08:26 -0400 (Wed, 15 Jul 2015)
Log Message:
-----------
refactor to print a friendly message if the files do not match

Modified Paths:
--------------
    trunk/lib/libmport/delete_primative.c

Modified: trunk/lib/libmport/delete_primative.c
===================================================================
--- trunk/lib/libmport/delete_primative.c	2015-07-15 11:25:25 UTC (rev 7092)
+++ trunk/lib/libmport/delete_primative.c	2015-07-15 12:08:26 UTC (rev 7093)
@@ -167,17 +167,17 @@
               char sample_md5[33];
               char nonSample[FILENAME_MAX];
               strlcpy(nonSample, file, FILENAME_MAX);
-              char *sptr = strcasestr(file, ".sample");
+              char *sptr = strcasestr(nonSample, ".sample");
               if (sptr != NULL) {
                   sptr[0] = '\0'; /* hack off .sample */
                   if (MD5File(nonSample, sample_md5) == NULL) {
+                      mport_call_msg_cb(mport, "Could not check file %s, review and remove manually.", nonSample);
+                  } else if (strcmp(sample_md5, md5) == 0) {
+		      if (unlink(nonSample) != 0)
+          	          mport_call_msg_cb(mport, "Could not unlink %s: %s", file, strerror(errno));
+		  } else {
                       mport_call_msg_cb(mport, "File does not match sample, remove file %s manually.", nonSample);
-                  } else {
-                      if (strcmp(sample_md5, md5) == 0) {
-		          if (unlink(nonSample) != 0)
-          	   	    mport_call_msg_cb(mport, "Could not unlink %s: %s", file, strerror(errno));
-		      } 
-                  }
+		  }
               }
           }
         }



More information about the Midnightbsd-cvs mailing list