[Midnightbsd-cvs] src [7092] trunk/lib/libmport/bundle_read_install_pkg.c: partial fix.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Jul 15 07:25:25 EDT 2015


Revision: 7092
          http://svnweb.midnightbsd.org/src/?rev=7092
Author:   laffer1
Date:     2015-07-15 07:25:25 -0400 (Wed, 15 Jul 2015)
Log Message:
-----------
partial fix. we are now generating the sample file correctly. on deinstall it is always removed though

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

Modified: trunk/lib/libmport/bundle_read_install_pkg.c
===================================================================
--- trunk/lib/libmport/bundle_read_install_pkg.c	2015-07-15 11:07:03 UTC (rev 7091)
+++ trunk/lib/libmport/bundle_read_install_pkg.c	2015-07-15 11:25:25 UTC (rev 7092)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013, 2014 Lucas Holt
+ * Copyright (c) 2013-2015 Lucas Holt
  * Copyright (c) 2007-2009 Chris Reinhardt
  * All rights reserved.
  *
@@ -240,10 +240,9 @@
 		/* for sample files, if we don't have an existing file
 		   make a new one */
 		if (type == ASSET_SAMPLE) {
-			char *nonSample = strdup(file);
-			if (nonSample == NULL)
-				goto ERROR;
-			char *sptr = strcasestr(file, ".sample");
+			char nonSample[FILENAME_MAX];
+			strlcpy(nonSample, file, FILENAME_MAX);
+			char *sptr = strcasestr(nonSample, ".sample");
 			if (sptr != NULL) {
 				sptr[0] = '\0'; /* hack off .sample */
 				if (!mport_file_exists(nonSample)) {
@@ -250,7 +249,6 @@
 					mport_copy_file(file, nonSample); 
 				}
 			}
-			free(nonSample);
 		}
 	}
 



More information about the Midnightbsd-cvs mailing list