svn commit: trunk/busybox: libbb loginutils util-linux

aldot at busybox.net aldot at busybox.net
Tue Jan 31 17:57:51 UTC 2006


Author: aldot
Date: 2006-01-31 09:57:48 -0800 (Tue, 31 Jan 2006)
New Revision: 13762

Log:
- bzero -> memset
   text    data     bss     dec     hex filename
1652855   14444 1215616 2882915  2bfd63 busybox.oorig.gcc-3.3
1652823   14444 1215616 2882883  2bfd43 busybox.gcc-3.3
1603655   14412 1215552 2833619  2b3cd3 busybox.oorig.gcc-3.4
1603655   14412 1215552 2833619  2b3cd3 busybox.gcc-3.4
1609755   14508 1215744 2840007  2b55c7 busybox.oorig.gcc-4.0
1609755   14508 1215744 2840007  2b55c7 busybox.gcc-4.0
1590495   13516 1215392 2819403  2b054b busybox.oorig.gcc-4.1-HEAD
1590495   13516 1215392 2819403  2b054b busybox.gcc-4.1-HEAD
1589079   13036 1213248 2815363  2af583 busybox.oorig.gcc-4.2-HEAD
1589079   13036 1213248 2815363  2af583 busybox.gcc-4.2-HEAD



Modified:
   trunk/busybox/libbb/dump.c
   trunk/busybox/loginutils/passwd.c
   trunk/busybox/loginutils/sulogin.c
   trunk/busybox/util-linux/fdisk.c


Changeset:
Modified: trunk/busybox/libbb/dump.c
===================================================================
--- trunk/busybox/libbb/dump.c	2006-01-31 14:41:37 UTC (rev 13761)
+++ trunk/busybox/libbb/dump.c	2006-01-31 17:57:48 UTC (rev 13762)
@@ -5,20 +5,8 @@
  * Copyright (c) 1989
  *	The Regents of the University of California.  All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
  * Original copyright notice is retained at the end of this file.
  */
 
@@ -398,7 +386,7 @@
 				}
 				return ((u_char *) NULL);
 			}
-			bzero((char *) curp + nread, need);
+			memset((char *) curp + nread, 0, need);
 			eaddress = address + nread;
 			return (curp);
 		}

Modified: trunk/busybox/loginutils/passwd.c
===================================================================
--- trunk/busybox/loginutils/passwd.c	2006-01-31 14:41:37 UTC (rev 13761)
+++ trunk/busybox/loginutils/passwd.c	2006-01-31 17:57:48 UTC (rev 13762)
@@ -45,7 +45,7 @@
 	struct stat sb;
 	struct flock lock;
 
-#ifdef CONFIG_FEATURE_SHADOWPASSWDS
+#if ENABLE_FEATURE_SHADOWPASSWDS
 	if (access(bb_path_shadow_file, F_OK) == 0) {
 		snprintf(filename, sizeof filename, "%s", bb_path_shadow_file);
 	} else
@@ -93,8 +93,9 @@
 	rewind(fp);
 	while (!feof(fp)) {
 		fgets(buffer, sizeof buffer, fp);
-		if (!continued) {		// Check to see if we're updating this line.
-			if (strncmp(username, buffer, strlen(username)) == 0) {	// we have a match.
+		if (!continued) { /* Check to see if we're updating this line.  */
+			if (strncmp(username, buffer, strlen(username)) == 0) {
+				/* we have a match. */
 				pw_rest = strchr(buffer, ':');
 				*pw_rest++ = '\0';
 				pw_rest = strchr(pw_rest, ':');
@@ -110,7 +111,7 @@
 		} else {
 			continued = 1;
 		}
-		bzero(buffer, sizeof buffer);
+		memset(buffer, 0, sizeof buffer);
 	}
 
 	if (fflush(out_fp) || fsync(fileno(out_fp)) || fclose(out_fp)) {
@@ -145,9 +146,9 @@
 	int dflg = 0;				/* -d - delete password */
 	const struct passwd *pw;
 
-#ifdef CONFIG_FEATURE_SHADOWPASSWDS
+#if ENABLE_FEATURE_SHADOWPASSWDS
 	const struct spwd *sp;
-#endif							/* CONFIG_FEATURE_SHADOWPASSWDS */
+#endif
 	amroot = (getuid() == 0);
 	openlog("passwd", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH);
 	while ((flag = getopt(argc, argv, "a:dlu")) != EOF) {
@@ -186,7 +187,7 @@
 		syslog(LOG_WARNING, "can't change pwd for `%s'", name);
 		bb_error_msg_and_die("Permission denied.\n");
 	}
-#ifdef CONFIG_FEATURE_SHADOWPASSWDS
+#if ENABLE_FEATURE_SHADOWPASSWDS
 	sp = getspnam(name);
 	if (!sp) {
 		sp = (struct spwd *) pwd_to_spwd(pw);
@@ -196,7 +197,7 @@
 #else
 	cp = pw->pw_passwd;
 	np = name;
-#endif							/* CONFIG_FEATURE_SHADOWPASSWDS */
+#endif
 
 	safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd));
 	if (!(dflg || lflg || uflg)) {
@@ -339,8 +340,8 @@
 			return 1;
 		}
 		safe_strncpy(orig, clear, sizeof(orig));
-		bzero(clear, strlen(clear));
-		bzero(cipher, strlen(cipher));
+		memset(clear, 0, strlen(clear));
+		memset(cipher, 0, strlen(cipher));
 	} else {
 		orig[0] = '\0';
 	}
@@ -348,12 +349,12 @@
 					  "Please use a combination of upper and lower case letters and numbers.\n"
 					  "Enter new password: ")))
 	{
-		bzero(orig, sizeof orig);
+		memset(orig, 0, sizeof orig);
 		/* return -1; */
 		return 1;
 	}
 	safe_strncpy(pass, cp, sizeof(pass));
-	bzero(cp, strlen(cp));
+	memset(cp, 0, strlen(cp));
 	/* if (!obscure(orig, pass, pw)) { */
 	if (obscure(orig, pass, pw)) {
 		if (amroot) {
@@ -364,7 +365,7 @@
 		}
 	}
 	if (!(cp = bb_askpass(0, "Re-enter new password: "))) {
-		bzero(orig, sizeof orig);
+		memset(orig, 0, sizeof orig);
 		/* return -1; */
 		return 1;
 	}
@@ -373,14 +374,14 @@
 		/* return -1; */
 		return 1;
 	}
-	bzero(cp, strlen(cp));
-	bzero(orig, sizeof(orig));
+	memset(cp, 0, strlen(cp));
+	memset(orig, 0, sizeof(orig));
 
 	if (algo == 1) {
 		cp = pw_encrypt(pass, "$1$");
 	} else
 		cp = pw_encrypt(pass, crypt_make_salt());
-	bzero(pass, sizeof pass);
+	memset(pass, 0, sizeof pass);
 	safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd));
 	return 0;
 }

Modified: trunk/busybox/loginutils/sulogin.c
===================================================================
--- trunk/busybox/loginutils/sulogin.c	2006-01-31 14:41:37 UTC (rev 13761)
+++ trunk/busybox/loginutils/sulogin.c	2006-01-31 17:57:48 UTC (rev 13762)
@@ -17,7 +17,6 @@
 #include "busybox.h"
 
 
-// sulogin defines
 #define SULOGIN_PROMPT "\nGive root password for system maintenance\n" \
 	"(or type Control-D for normal startup):"
 
@@ -41,7 +40,7 @@
 
 
 
-static void catchalarm(int junk)
+static void catchalarm(int ATTRIBUTE_UNUSED junk)
 {
 	exit(EXIT_FAILURE);
 }
@@ -59,9 +58,9 @@
 	struct passwd pwent;
 	struct passwd *pwd;
 	const char * const *p;
-#ifdef CONFIG_FEATURE_SHADOWPASSWDS
+#if ENABLE_FEATURE_SHADOWPASSWDS
 	struct spwd *spwd = NULL;
-#endif							/* CONFIG_FEATURE_SHADOWPASSWDS */
+#endif
 
 	openlog("sulogin", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH);
 	if (argc > 1) {
@@ -114,7 +113,7 @@
 		bb_error_msg_and_die("No password entry for `root'\n");
 	}
 	pwent = *pwd;
-#ifdef CONFIG_FEATURE_SHADOWPASSWDS
+#if ENABLE_FEATURE_SHADOWPASSWDS
 	spwd = NULL;
 	if (pwd && ((strcmp(pwd->pw_passwd, "x") == 0)
 				|| (strcmp(pwd->pw_passwd, "*") == 0))) {
@@ -124,7 +123,7 @@
 			pwent.pw_passwd = spwd->sp_pwdp;
 		}
 	}
-#endif							/* CONFIG_FEATURE_SHADOWPASSWDS */
+#endif
 	while (1) {
 		cp = bb_askpass(timeout, SULOGIN_PROMPT);
 		if (!cp || !*cp) {
@@ -134,7 +133,7 @@
 			exit(EXIT_SUCCESS);
 		} else {
 			safe_strncpy(pass, cp, sizeof(pass));
-			bzero(cp, strlen(cp));
+			memset(cp, 0, strlen(cp));
 		}
 		if (strcmp(pw_encrypt(pass, pwent.pw_passwd), pwent.pw_passwd) == 0) {
 			break;
@@ -144,13 +143,13 @@
 		fflush(stdout);
 		syslog(LOG_WARNING, "Incorrect root password\n");
 	}
-	bzero(pass, strlen(pass));
+	memset(pass, 0, strlen(pass));
 	signal(SIGALRM, SIG_DFL);
 	puts("Entering System Maintenance Mode\n");
 	fflush(stdout);
 	syslog(LOG_INFO, "System Maintenance Mode\n");
 
-#ifdef CONFIG_SELINUX
+#if ENABLE_SELINUX
 	renew_current_security_context();
 #endif
 

Modified: trunk/busybox/util-linux/fdisk.c
===================================================================
--- trunk/busybox/util-linux/fdisk.c	2006-01-31 14:41:37 UTC (rev 13761)
+++ trunk/busybox/util-linux/fdisk.c	2006-01-31 17:57:48 UTC (rev 13762)
@@ -1342,7 +1342,7 @@
   bcopy (d, &dl, sizeof (struct xbsd_disklabel));
 
   /* The disklabel will be overwritten by 0's from bootxx anyway */
-  bzero (d, sizeof (struct xbsd_disklabel));
+  memset (d, 0, sizeof (struct xbsd_disklabel));
 
   snprintf (path, sizeof(path), "%s/boot%s", bootdir, dkbasename);
   if (!xbsd_get_bootstrap (path, &disklabelbuffer[xbsd_dlabel.d_secsize],
@@ -1457,7 +1457,7 @@
 	struct xbsd_partition *pp;
 
 	get_geometry ();
-	bzero (d, sizeof (struct xbsd_disklabel));
+	memset (d, 0, sizeof (struct xbsd_disklabel));
 
 	d -> d_magic = BSD_DISKMAGIC;
 




More information about the busybox-cvs mailing list