[BusyBox] CVS: ls doesn't list groups of mounted mount points correctly

Matt Kraai kraai at alumni.carnegiemellon.edu
Fri Nov 17 19:11:00 UTC 2000


Howdy,

I can't test it at the moment, but the attached patch *may* fix this
problem.  If you could test it out and let me know, I'd appreciate it.
Then again, it might not even compile.

Matt
-------------- next part --------------
--- ls.c.orig	Fri Nov 17 10:58:56 2000
+++ ls.c	Fri Nov 17 11:04:25 2000
@@ -531,7 +531,7 @@
 	char *filetime;
 	time_t ttime, age;
 #endif
-#if defined (BB_FEATURE_LS_FILETYPES) || defined (BB_FEATURE_LS_USERNAME)
+#if defined (BB_FEATURE_LS_FILETYPES)
 	struct stat info;
 #endif
 #ifdef BB_FEATURE_LS_FILETYPES
@@ -574,28 +574,19 @@
 				break;
 			case LIST_ID_NAME:
 #ifdef BB_FEATURE_LS_USERNAME
-				{
-					memset(&info, 0, sizeof(struct stat));
-					memset(scratch, 0, sizeof(scratch));
-					if (!stat(dn->fullname, &info)) {
-						my_getpwuid(scratch, info.st_uid);
-					}
-					if (*scratch) {
-						fprintf(stdout, "%-8.8s ", scratch);
-					} else {
-						fprintf(stdout, "%-8d ", dn->dstat.st_uid);
-					}
-					memset(scratch, 0, sizeof(scratch));
-					if (info.st_ctime != 0) {
-						my_getgrgid(scratch, info.st_gid);
-					}
-					if (*scratch) {
-						fprintf(stdout, "%-8.8s", scratch);
-					} else {
-						fprintf(stdout, "%-8d", dn->dstat.st_gid);
-					}
+				memset(scratch, 0, sizeof(scratch));
+				my_getpwuid(scratch, dn->dstat.st_uid);
+				if (*scratch)
+					fprintf(stdout, "%-8.8s ", scratch);
+				else
+					fprintf(stdout, "%-8d ", dn->dstat.st_uid);
+				memset(scratch, 0, sizeof(scratch));
+				my_getgrgid(scratch, dn->dstat.st_gid);
+				if (*scratch)
+					fprintf(stdout, "%-8.8s", scratch);
+				else
+					fprintf(stdout, "%-8d", dn->dstat.st_gid);
 				column += 17;
-				}
 				break;
 #endif
 			case LIST_ID_NUMERIC:


More information about the busybox mailing list