PERFORCE change 18354 for review

Robert Watson rwatson at freebsd.org
Mon Sep 30 03:31:08 GMT 2002


http://people.freebsd.org/~peter/p4db/chv.cgi?CH=18354

Change 18354 by rwatson at rwatson_tislabs on 2002/09/29 20:30:58

	Clean up MAC label processing in ls slightly.  Note that this
	code is currently wrong because it doesn't construct the correct
	path to the object that it's going to retrieve labels for,
	so depending on the invocation, this may or may not work well.
	I'll clean it up tomorrow sometime.

Affected files ...

.. //depot/projects/trustedbsd/mac/bin/ls/ls.c#11 edit

Differences ...

==== //depot/projects/trustedbsd/mac/bin/ls/ls.c#11 (text+ko) ====

@@ -693,12 +693,19 @@
 						goto label_out;
 					}
 
-					error = mac_get_file(cur->fts_name,
-					    label);
-					if (error != MAC_SUCCESS) {
-						fprintf(stderr, "%s: %s\n",
-						    cur->fts_name,
-						    mac_error(error));
+#if 0
+					if (S_ISLNK(sp->st_mode))
+#endif
+						error = mac_get_link(
+						    cur->fts_path, label);
+#if 0
+					else
+						error = mac_get_file(
+						    cur->fts_name, label);
+#endif
+					if (error == -1) {
+						perror(cur->fts_name);
+						mac_free(label);
 						goto label_out;
 					}
 
@@ -708,13 +715,13 @@
 						fprintf(stderr, "%s: %s\n",
 						    cur->fts_name,
 						    mac_error(error));
+						mac_free(label);
 						goto label_out;
 					}
-
+					mac_free(label);
+label_out:
 					if (labelstr == NULL)
 						labelstr = strdup("");
-
-label_out:
 					labelstrlen = strlen(labelstr);
 					if (labelstrlen > maxlabelstr)
 						maxlabelstr = labelstrlen;
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list