PERFORCE change 114875 for review

Todd Miller millert at FreeBSD.org
Fri Feb 23 16:51:01 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=114875

Change 114875 by millert at millert_macbook on 2007/02/23 16:50:50

	Use strdupa() now that we have it in libsecompat

Affected files ...

.. //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/policycoreutils/restorecon/restorecon.c#6 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/policycoreutils/restorecon/restorecon.c#6 (text+ko) ====

@@ -177,16 +177,14 @@
 				"Warning! %s refers to a symbolic link, not following last component.\n",
 				filename);
 		char *p = NULL, *file_sep;
-		char *tmp_path;
+		char *tmp_path = strdupa(filename);
 		size_t len = 0;
 
-		tmp_path = alloca(strlen(filename) + 1);
 		if (!tmp_path) {
 			fprintf(stderr, "strdupa on %s failed:  %s\n", filename,
 				strerror(errno));
 			return 1;
 		}
-		strcpy(tmp_path, filename);
 		file_sep = strrchr(tmp_path, '/');
 		if (file_sep == tmp_path) {
 			file_sep++;


More information about the p4-projects mailing list