[Midnightbsd-cvs] src [7361] trunk/usr.sbin/mport/mport.c: during an update with a bad hash verification, try to unlink the file.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Nov 15 22:09:21 EST 2015


Revision: 7361
          http://svnweb.midnightbsd.org/src/?rev=7361
Author:   laffer1
Date:     2015-11-15 22:09:21 -0500 (Sun, 15 Nov 2015)
Log Message:
-----------
during an update with a bad hash verification, try to unlink the file. If we cant tell the user to delete it manually.

Modified Paths:
--------------
    trunk/usr.sbin/mport/mport.c

Modified: trunk/usr.sbin/mport/mport.c
===================================================================
--- trunk/usr.sbin/mport/mport.c	2015-11-13 13:16:21 UTC (rev 7360)
+++ trunk/usr.sbin/mport/mport.c	2015-11-16 03:09:21 UTC (rev 7361)
@@ -548,7 +548,10 @@
 	}
 
 	if (!mport_verify_hash(path, (*indexEntry)->hash)) {
-		fprintf(stderr, "Package fails hash verification.\n");
+		if (unlink(path) == 0)  /* remove file so we can try again */
+			fprintf(stderr, "Package fails hash verification and was removed. Please try again.\n");
+		else
+			fprintf(stderr, "Package fails hash verification Please delete it manually at %s\n", path);
 		free(path);
 		return (1);
 	}



More information about the Midnightbsd-cvs mailing list