diff mbox

Delete dead code? [BZ 19653]

Message ID CALoOobPWnKob6y-po+dvbT-YT5hCgxZwxd-vzrZcs_gEXcg-ig@mail.gmail.com
State New
Headers show

Commit Message

Paul Pluzhnikov March 20, 2016, 6:35 p.m. UTC
Greetings,

Quoting from https://sourceware.org/bugzilla/show_bug.cgi?id=19653
"if this is re-enabled in the future, it could segmentation fault
without the check for NULL from malloc()."

AFAICT, the code comes from:

commit 49633efbcc056cc97928b22ff274b5774839bfae
Author: Roland McGrath <roland@gnu.org>
Date:   Wed Jul 26 00:13:55 1995 +0000

    New file, based on NET2 code but with DES code removed.

and has been ifdef'd out since then.

Should we just delete the '#if 0'd blocks?


2016-03-20  Paul Pluzhnikov  <ppluzhnikov@google.com>

        [BZ 19653]
        * inet/if_index.c (__protocol_available): Delete.
        * inet/ruserpass.c (ruserpass): Delete #if 0'd code.


Thanks,

Comments

Mike Frysinger March 21, 2016, 6:19 a.m. UTC | #1
On 20 Mar 2016 11:35, Paul Pluzhnikov wrote:
> Quoting from https://sourceware.org/bugzilla/show_bug.cgi?id=19653
> "if this is re-enabled in the future, it could segmentation fault
> without the check for NULL from malloc()."
> 
> AFAICT, the code comes from:
> 
> commit 49633efbcc056cc97928b22ff274b5774839bfae
> Author: Roland McGrath <roland@gnu.org>
> Date:   Wed Jul 26 00:13:55 1995 +0000
> 
>     New file, based on NET2 code but with DES code removed.
> 
> and has been ifdef'd out since then.
> 
> Should we just delete the '#if 0'd blocks?

it's all dead code (since it's only used by RPC), so deleting #if 0
here seems fine to me.  it's not like we're going to be taking any
more enhancements.
-mike
Paul Pluzhnikov May 30, 2016, 5:01 a.m. UTC | #2
On Sun, Mar 20, 2016 at 11:19 PM, Mike Frysinger <vapier@gentoo.org> wrote:

> it's all dead code (since it's only used by RPC), so deleting #if 0
> here seems fine to me.  it's not like we're going to be taking any
> more enhancements.

Any objection to deleting the '#if 0' code?
I'd like to commit this patch:
https://sourceware.org/ml/libc-alpha/2016-03/msg00508.html

Thanks,
Florian Weimer May 30, 2016, 10:59 a.m. UTC | #3
On 03/20/2016 07:35 PM, Paul Pluzhnikov wrote:
> 2016-03-20  Paul Pluzhnikov  <ppluzhnikov@google.com>
>
>         [BZ 19653]
>         * inet/if_index.c (__protocol_available): Delete.
>         * inet/ruserpass.c (ruserpass): Delete #if 0'd code.

Looks good to me.

Thanks,
Florian
diff mbox

Patch

diff --git a/inet/if_index.c b/inet/if_index.c
index b55e427..d8054fc 100644
--- a/inet/if_index.c
+++ b/inet/if_index.c
@@ -58,14 +58,3 @@  __if_nameindex (void)
 weak_alias (__if_nameindex, if_nameindex)
 libc_hidden_weak (if_nameindex)
 stub_warning (if_nameindex)
-
-#if 0
-void
-internal_function
-__protocol_available (int *have_inet, int *have_inet6)
-{
-  /* By default we assume that IPv4 is available, IPv6 not.  */
-  *have_inet = 1;
-  *have_inet6 = 0;
-}
-#endif
diff --git a/inet/ruserpass.c b/inet/ruserpass.c
index ff379db..a41668c 100644
--- a/inet/ruserpass.c
+++ b/inet/ruserpass.c
@@ -196,81 +196,8 @@  next:
 			}
 			break;
 		case ACCOUNT:
-#if 0
-			if (fstat64(fileno(cfile), &stb) >= 0
-			    && (stb.st_mode & 077) != 0) {
-	warnx("Error: .netrc file is readable by others.");
-	warnx("Remove account or make file unreadable by others.");
-				goto bad;
-			}
-			if (token() && *aacct == 0) {
-				*aacct = malloc((unsigned) strlen(tokval) + 1);
-				(void) strcpy(*aacct, tokval);
-			}
-#endif
 			break;
 		case MACDEF:
-#if 0
-			if (proxy) {
-				(void) fclose(cfile);
-				return (0);
-			}
-			while ((c=getc_unlocked(cfile)) != EOF && c == ' '
-			       || c == '\t');
-			if (c == EOF || c == '\n') {
-				printf("Missing macdef name argument.\n");
-				goto bad;
-			}
-			if (macnum == 16) {
-				printf("Limit of 16 macros have already been defined\n");
-				goto bad;
-			}
-			tmp = macros[macnum].mac_name;
-			*tmp++ = c;
-			for (i=0; i < 8 && (c=getc_unlocked(cfile)) != EOF &&
-			    !isspace(c); ++i) {
-				*tmp++ = c;
-			}
-			if (c == EOF) {
-				printf("Macro definition missing null line terminator.\n");
-				goto bad;
-			}
-			*tmp = '\0';
-			if (c != '\n') {
-				while ((c=getc_unlocked(cfile)) != EOF
-				       && c != '\n');
-			}
-			if (c == EOF) {
-				printf("Macro definition missing null line terminator.\n");
-				goto bad;
-			}
-			if (macnum == 0) {
-				macros[macnum].mac_start = macbuf;
-			}
-			else {
-				macros[macnum].mac_start = macros[macnum-1].mac_end + 1;
-			}
-			tmp = macros[macnum].mac_start;
-			while (tmp != macbuf + 4096) {
-				if ((c=getc_unlocked(cfile)) == EOF) {
-				printf("Macro definition missing null line terminator.\n");
-					goto bad;
-				}
-				*tmp = c;
-				if (*tmp == '\n') {
-					if (*(tmp-1) == '\0') {
-					   macros[macnum++].mac_end = tmp - 1;
-					   break;
-					}
-					*tmp = '\0';
-				}
-				tmp++;
-			}
-			if (tmp == macbuf + 4096) {
-				printf("4K macro buffer exceeded\n");
-				goto bad;
-			}
-#endif
 			break;
 		default:
 			warnx(_("Unknown .netrc keyword %s"), tokval);