svn commit: trunk/busybox: archival archival/libunarchive coreutils etc...

vda at busybox.net vda at busybox.net
Sat Feb 16 13:18:18 UTC 2008


Author: vda
Date: 2008-02-16 05:18:17 -0800 (Sat, 16 Feb 2008)
New Revision: 21037

Log:
random s/short/int/

add_cmd                                             1189    1190      +1
xconnect_ftpdata                                     118     117      -1
data_align                                            86      84      -2
process_files                                       2101    2096      -5
forkexec                                            1345    1334     -11



Modified:
   trunk/busybox/archival/libunarchive/data_align.c
   trunk/busybox/archival/tar.c
   trunk/busybox/coreutils/Kbuild
   trunk/busybox/editors/sed.c
   trunk/busybox/include/libbb.h
   trunk/busybox/include/unarchive.h
   trunk/busybox/miscutils/hdparm.c
   trunk/busybox/networking/ftpgetput.c
   trunk/busybox/networking/httpd.c
   trunk/busybox/networking/libiproute/ll_proto.c
   trunk/busybox/networking/libiproute/utils.h
   trunk/busybox/shell/hush.c
   trunk/busybox/shell/msh.c
   trunk/busybox/util-linux/fdisk_aix.c
   trunk/busybox/util-linux/fdisk_sgi.c
   trunk/busybox/util-linux/ipcrm.c
   trunk/busybox/util-linux/ipcs.c


Changeset:
Modified: trunk/busybox/archival/libunarchive/data_align.c
===================================================================
--- trunk/busybox/archival/libunarchive/data_align.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/archival/libunarchive/data_align.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -3,14 +3,12 @@
  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
-//#include <sys/types.h>
-
 #include "libbb.h"
 #include "unarchive.h"
 
-void data_align(archive_handle_t *archive_handle, const unsigned short boundary)
+void data_align(archive_handle_t *archive_handle, unsigned boundary)
 {
-	const unsigned short skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary;
+	unsigned skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary;
 
 	archive_handle->seek(archive_handle, skip_amount);
 	archive_handle->offset += skip_amount;

Modified: trunk/busybox/archival/tar.c
===================================================================
--- trunk/busybox/archival/tar.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/archival/tar.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -546,13 +546,16 @@
 
 		if (gzipPid == 0) {
 			/* child */
-			xmove_fd(tbInfo.tarFd, 1);
-			xmove_fd(gzipDataPipe.rd, 0);
+			/* NB: close _first_, then move fds! */
 			close(gzipDataPipe.wr);
 #if WAIT_FOR_CHILD
 			close(gzipStatusPipe.rd);
+			/* gzipStatusPipe.wr will close only on exec -
+			 * parent waits for this close to happen */
 			fcntl(gzipStatusPipe.wr, F_SETFD, FD_CLOEXEC);
 #endif
+			xmove_fd(gzipDataPipe.rd, 0);
+			xmove_fd(tbInfo.tarFd, 1);
 			/* exec gzip/bzip2 program/applet */
 			BB_EXECLP(zip_exec, zip_exec, "-f", NULL);
 			vfork_exec_errno = errno;
@@ -570,7 +573,7 @@
 
 			/* Wait until child execs (or fails to) */
 			n = full_read(gzipStatusPipe.rd, &buf, 1);
-			if ((n < 0) && (/*errno == EAGAIN ||*/ errno == EINTR))
+			if (n < 0 /* && errno == EAGAIN */)
 				continue;	/* try it again */
 
 		}

Modified: trunk/busybox/coreutils/Kbuild
===================================================================
--- trunk/busybox/coreutils/Kbuild	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/coreutils/Kbuild	2008-02-16 13:18:17 UTC (rev 21037)
@@ -12,6 +12,7 @@
 lib-$(CONFIG_CAT)       += cat.o
 lib-$(CONFIG_MORE)      += cat.o # more uses it if stdout isn't a tty
 lib-$(CONFIG_LESS)      += cat.o # less too
+lib-$(CONFIG_CRONTAB)   += cat.o # crontab -l
 lib-$(CONFIG_CATV)      += catv.o
 lib-$(CONFIG_CHGRP)     += chgrp.o chown.o
 lib-$(CONFIG_CHMOD)     += chmod.o

Modified: trunk/busybox/editors/sed.c
===================================================================
--- trunk/busybox/editors/sed.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/editors/sed.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -76,7 +76,7 @@
 	FILE *sw_file;          /* File (sw) command writes to, -1 for none. */
 	char *string;           /* Data string for (saicytb) commands. */
 
-	unsigned short which_match; /* (s) Which match to replace (0 for all) */
+	unsigned which_match;   /* (s) Which match to replace (0 for all) */
 
 	/* Bitfields (gcc won't group them if we don't) */
 	unsigned invert:1;      /* the '!' after the address */
@@ -353,7 +353,7 @@
 				/* Match 0 treated as all, multiple matches we take the last one. */
 				const char *pos = substr + idx;
 /* FIXME: error check? */
-				sed_cmd->which_match = (unsigned short)strtol(substr+idx, (char**) &pos, 10);
+				sed_cmd->which_match = (unsigned)strtol(substr+idx, (char**) &pos, 10);
 				idx = pos - substr;
 			}
 			continue;
@@ -364,7 +364,8 @@
 		switch (substr[idx]) {
 		/* Replace all occurrences */
 		case 'g':
-			if (match[0] != '^') sed_cmd->which_match = 0;
+			if (match[0] != '^')
+				sed_cmd->which_match = 0;
 			break;
 		/* Print pattern space */
 		case 'p':
@@ -683,7 +684,8 @@
 		altered++;
 
 		/* if we're not doing this globally, get out now */
-		if (sed_cmd->which_match) break;
+		if (sed_cmd->which_match)
+			break;
 	} while (*oldline && (regexec(current_regex, oldline, 10, G.regmatch, 0) != REG_NOMATCH));
 
 	/* Copy rest of string into output pipeline */

Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/include/libbb.h	2008-02-16 13:18:17 UTC (rev 21037)
@@ -595,14 +595,14 @@
 pid_t spawn(char **argv);
 pid_t xspawn(char **argv);
 
-/* Unlike waitpid, waits ONLY for one process,
+int safe_waitpid(int pid, int *wstat, int options);
+/* Unlike waitpid, waits ONLY for one process.
  * It's safe to pass negative 'pids' from failed [v]fork -
  * wait4pid will return -1 (and will not clobber [v]fork's errno).
  * IOW: rc = wait4pid(spawn(argv));
  *      if (rc < 0) bb_perror_msg("%s", argv[0]);
  *      if (rc > 0) bb_error_msg("exit code: %d", rc);
  */
-int safe_waitpid(int pid, int *wstat, int options);
 int wait4pid(int pid);
 int wait_any_nohang(int *wstat);
 #define wait_crashed(w) ((w) & 127)

Modified: trunk/busybox/include/unarchive.h
===================================================================
--- trunk/busybox/include/unarchive.h	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/include/unarchive.h	2008-02-16 13:18:17 UTC (rev 21037)
@@ -97,7 +97,7 @@
 
 extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count);
 
-extern void data_align(archive_handle_t *archive_handle, const unsigned short boundary);
+extern void data_align(archive_handle_t *archive_handle, unsigned boundary);
 extern const llist_t *find_list_entry(const llist_t *list, const char *filename);
 extern const llist_t *find_list_entry2(const llist_t *list, const char *filename);
 

Modified: trunk/busybox/miscutils/hdparm.c
===================================================================
--- trunk/busybox/miscutils/hdparm.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/miscutils/hdparm.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -1168,7 +1168,7 @@
 static void dump_identity(const struct hd_driveid *id)
 {
 	int i;
-	const unsigned short int *id_regs = (const void*) id;
+	const unsigned short *id_regs = (const void*) id;
 
 	printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s\n Config={",
 				id->model, id->fw_rev, id->serial_no);

Modified: trunk/busybox/networking/ftpgetput.c
===================================================================
--- trunk/busybox/networking/ftpgetput.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/networking/ftpgetput.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -72,7 +72,7 @@
 static int xconnect_ftpdata(ftp_host_info_t *server, char *buf)
 {
 	char *buf_ptr;
-	unsigned short port_num;
+	unsigned port_num;
 
 	/* Response is "NNN garbageN1,N2,N3,N4,P1,P2[)garbage]
 	 * Server's IP is N1.N2.N3.N4 (we ignore it)

Modified: trunk/busybox/networking/httpd.c
===================================================================
--- trunk/busybox/networking/httpd.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/networking/httpd.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -1409,10 +1409,11 @@
 		/* Child process */
 		xfunc_error_retval = 242;
 
+		/* NB: close _first_, then move fds! */
+		close(toCgi.wr);
+		close(fromCgi.rd);
 		xmove_fd(toCgi.rd, 0);  /* replace stdin with the pipe */
 		xmove_fd(fromCgi.wr, 1);  /* replace stdout with the pipe */
-		close(fromCgi.rd);
-		close(toCgi.wr);
 		/* User seeing stderr output can be a security problem.
 		 * If CGI really wants that, it can always do dup itself. */
 		/* dup2(1, 2); */

Modified: trunk/busybox/networking/libiproute/ll_proto.c
===================================================================
--- trunk/busybox/networking/libiproute/ll_proto.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/networking/libiproute/ll_proto.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -102,7 +102,7 @@
 
 	id = ntohs(id);
 
-	for (i=0; i < ARRAY_SIZE(llproto_names); i++) {
+	for (i = 0; i < ARRAY_SIZE(llproto_names); i++) {
 		 if (llproto_names[i].id == id)
 			return llproto_names[i].name;
 	}
@@ -113,7 +113,7 @@
 int ll_proto_a2n(unsigned short *id, char *buf)
 {
 	int i;
-	for (i=0; i < ARRAY_SIZE(llproto_names); i++) {
+	for (i = 0; i < ARRAY_SIZE(llproto_names); i++) {
 		 if (strcasecmp(llproto_names[i].name, buf) == 0) {
 			 *id = htons(llproto_names[i].id);
 			 return 0;

Modified: trunk/busybox/networking/libiproute/utils.h
===================================================================
--- trunk/busybox/networking/libiproute/utils.h	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/networking/libiproute/utils.h	2008-02-16 13:18:17 UTC (rev 21037)
@@ -42,8 +42,8 @@
 #endif
 
 struct dn_naddr {
-	unsigned short          a_len;
-	unsigned char a_addr[DN_MAXADDL];
+	unsigned short a_len;
+	unsigned char  a_addr[DN_MAXADDL];
 };
 
 #define IPX_NODE_LEN 6

Modified: trunk/busybox/shell/hush.c
===================================================================
--- trunk/busybox/shell/hush.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/shell/hush.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -3243,7 +3243,7 @@
 	if (pid == 0) { /* child */
 		if (ENABLE_HUSH_JOB)
 			die_sleep = 0; /* let nofork's xfuncs die */
-		close(channel[0]);
+		close(channel[0]); /* NB: close _first_, then move fd! */
 		xmove_fd(channel[1], 1);
 		/* Prevent it from trying to handle ctrl-z etc */
 #if ENABLE_HUSH_JOB

Modified: trunk/busybox/shell/msh.c
===================================================================
--- trunk/busybox/shell/msh.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/shell/msh.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -2797,15 +2797,13 @@
 			if (!bltin)
 				export(lookup(cp));
 
-	if (pin) {
+	if (pin) { /* NB: close _first_, then move fds! */
+		close(pin[1]);
 		xmove_fd(pin[0], 0);
-		if (pin[1] != 0)
-			close(pin[1]);
 	}
 	if (pout) {
+		close(pout[0]);
 		xmove_fd(pout[1], 1);
-		if (pout[0] > 1)
-			close(pout[0]);
 	}
 
 	iopp = t->ioact;

Modified: trunk/busybox/util-linux/fdisk_aix.c
===================================================================
--- trunk/busybox/util-linux/fdisk_aix.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/util-linux/fdisk_aix.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -29,8 +29,8 @@
   *      Some fixes
 */
 
-static int aix_other_endian;
-static short aix_volumes = 1;
+static smallint aix_other_endian; /* bool */
+static smallint aix_volumes = 1; /* max 15 */
 
 /*
  * only dealing with free blocks here

Modified: trunk/busybox/util-linux/fdisk_sgi.c
===================================================================
--- trunk/busybox/util-linux/fdisk_sgi.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/util-linux/fdisk_sgi.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -1,5 +1,7 @@
 #if ENABLE_FEATURE_SGI_LABEL
 
+#define SGI_DEBUG 0
+
 /*
  * Copyright (C) Andreas Neuper, Sep 1998.
  *      This file may be modified and redistributed under
@@ -117,9 +119,8 @@
  */
 
 
-static int sgi_other_endian;
-static int debug;
-static short sgi_volumes = 1;
+static smallint sgi_other_endian; /* bool */
+static smallint sgi_volumes = 1; /* max 15 */
 
 /*
  * only dealing with free blocks here
@@ -318,7 +319,7 @@
 		"Pt# %*s  Info     Start       End   Sectors  Id  System\n",
 		w + 2, "Device");
 	for (i = 0; i < g_partitions; i++) {
-		if (sgi_get_num_sectors(i) || debug ) {
+		if (sgi_get_num_sectors(i) || SGI_DEBUG) {
 			uint32_t start = sgi_get_start_sector(i);
 			uint32_t len = sgi_get_num_sectors(i);
 			kpi++;              /* only count nonempty partitions */
@@ -514,7 +515,7 @@
 				"at block 0,\n"
 				"not at diskblock %d\n",
 				sgi_get_start_sector(Index[0]));
-		if (debug)      /* I do not understand how some disks fulfil it */
+		if (SGI_DEBUG)      /* I do not understand how some disks fulfil it */
 			if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose)
 				printf("The entire disk partition is only %d diskblock large,\n"
 					"but the disk is %d diskblocks long\n",
@@ -523,7 +524,7 @@
 	} else {
 		if (verbose)
 			printf("One Partition (#11) should cover the entire disk\n");
-		if (debug > 2)
+		if (SGI_DEBUG > 2)
 			printf("sysid=%d\tpartition=%d\n",
 				sgi_get_sysid(Index[0]), Index[0]+1);
 	}
@@ -531,13 +532,13 @@
 		int cylsize = sgi_get_nsect() * sgi_get_ntrks();
 
 		if ((sgi_get_start_sector(Index[i]) % cylsize) != 0) {
-			if (debug)      /* I do not understand how some disks fulfil it */
+			if (SGI_DEBUG)      /* I do not understand how some disks fulfil it */
 				if (verbose)
 					printf("Partition %d does not start on cylinder boundary\n",
 						Index[i]+1);
 		}
 		if (sgi_get_num_sectors(Index[i]) % cylsize != 0) {
-			if (debug)      /* I do not understand how some disks fulfil it */
+			if (SGI_DEBUG)      /* I do not understand how some disks fulfil it */
 				if (verbose)
 					printf("Partition %d does not end on cylinder boundary\n",
 						Index[i]+1);
@@ -562,7 +563,7 @@
 		}
 		start = sgi_get_start_sector(Index[i])
 			   + sgi_get_num_sectors(Index[i]);
-		if (debug > 1) {
+		if (SGI_DEBUG > 1) {
 			if (verbose)
 				printf("%2d:%12d\t%12d\t%12d\n", Index[i],
 					sgi_get_start_sector(Index[i]),
@@ -805,7 +806,7 @@
 				old[i].start = get_start_sect(get_part_table(i));
 				old[i].nsect = get_nr_sects(get_part_table(i));
 				printf("Trying to keep parameters of partition %d\n", i);
-				if (debug)
+				if (SGI_DEBUG)
 					printf("ID=%02x\tSTART=%d\tLENGTH=%d\n",
 				old[i].sysid, old[i].start, old[i].nsect);
 			}

Modified: trunk/busybox/util-linux/ipcrm.c
===================================================================
--- trunk/busybox/util-linux/ipcrm.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/util-linux/ipcrm.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -24,7 +24,7 @@
 union semun {
 	int val;
 	struct semid_ds *buf;
-	unsigned short int *array;
+	unsigned short *array;
 	struct seminfo *__buf;
 };
 #endif

Modified: trunk/busybox/util-linux/ipcs.c
===================================================================
--- trunk/busybox/util-linux/ipcs.c	2008-02-16 13:17:13 UTC (rev 21036)
+++ trunk/busybox/util-linux/ipcs.c	2008-02-16 13:18:17 UTC (rev 21037)
@@ -68,7 +68,7 @@
 union semun {
 	int val;
 	struct semid_ds *buf;
-	unsigned short int *array;
+	unsigned short *array;
 	struct seminfo *__buf;
 };
 #endif




More information about the busybox-cvs mailing list