svn commit: trunk/busybox: coreutils procps

vda at busybox.net vda at busybox.net
Sun Jun 17 00:35:16 UTC 2007


Author: vda
Date: 2007-06-16 17:35:15 -0700 (Sat, 16 Jun 2007)
New Revision: 18838

Log:
install: fix install a b /a/link/to/dir
install: fix -s (strip) option
nmeter: add TODO


Modified:
   trunk/busybox/coreutils/install.c
   trunk/busybox/procps/nmeter.c


Changeset:
Modified: trunk/busybox/coreutils/install.c
===================================================================
--- trunk/busybox/coreutils/install.c	2007-06-16 20:52:33 UTC (rev 18837)
+++ trunk/busybox/coreutils/install.c	2007-06-17 00:35:15 UTC (rev 18838)
@@ -102,7 +102,8 @@
 	opt_complementary = "?:s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z");
 	/* -c exists for backwards compatibility, it's needed */
 
-	flags = getopt32(argc, argv, "cdpsg:m:o:" USE_SELINUX("Z:"), &gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext));
+	flags = getopt32(argc, argv, "cdpsg:m:o:" USE_SELINUX("Z:"),
+			&gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext));
 
 #if ENABLE_SELINUX
 	if (flags & OPT_PRESERVE_SECURITY_CONTEXT) {
@@ -165,7 +166,8 @@
 		return ret;
 	}
 
-	isdir = lstat(argv[argc - 1], &statbuf) < 0 ? 0 : S_ISDIR(statbuf.st_mode);
+	/* coreutils install resolves link in this case, don't use lstat */
+	isdir = stat(argv[argc - 1], &statbuf) < 0 ? 0 : S_ISDIR(statbuf.st_mode);
 
 	for (i = optind; i < argc - 1; i++) {
 		char *dest;
@@ -192,7 +194,11 @@
 			ret = EXIT_FAILURE;
 		}
 		if (flags & OPT_STRIP) {
-			if (BB_EXECLP("strip", "strip", dest, NULL) == -1) {
+			char *args[3];
+			args[0] = (char*)"strip";
+			args[1] = dest;
+			args[2] = NULL;
+			if (spawn_and_wait(args)) {
 				bb_perror_msg("strip");
 				ret = EXIT_FAILURE;
 			}

Modified: trunk/busybox/procps/nmeter.c
===================================================================
--- trunk/busybox/procps/nmeter.c	2007-06-16 20:52:33 UTC (rev 18837)
+++ trunk/busybox/procps/nmeter.c	2007-06-17 00:35:15 UTC (rev 18838)
@@ -11,9 +11,14 @@
 // /proc/stat:
 // disk_io: (3,0):(22272,17897,410702,4375,54750)
 // btime 1059401962
+//TODO: use sysinfo libc call/syscall, if appropriate
+// (faster than open/read/close):
+// sysinfo({uptime=15017, loads=[5728, 15040, 16480]
+//  totalram=2107416576, freeram=211525632, sharedram=0, bufferram=157204480}
+//  totalswap=134209536, freeswap=134209536, procs=157})
 
+#include <time.h>
 #include "libbb.h"
-#include <time.h>
 
 typedef unsigned long long ullong;
 




More information about the busybox-cvs mailing list