Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/modload couple cosmetic stylistic changes



details:   https://anonhg.NetBSD.org/src/rev/0a19bb71e381
branches:  trunk
changeset: 515615:0a19bb71e381
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Sep 29 21:15:11 2001 +0000

description:
couple cosmetic stylistic changes

diffstat:

 sbin/modload/modload.c |  17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diffs (56 lines):

diff -r 282f4e66c465 -r 0a19bb71e381 sbin/modload/modload.c
--- a/sbin/modload/modload.c    Sat Sep 29 20:10:07 2001 +0000
+++ b/sbin/modload/modload.c    Sat Sep 29 21:15:11 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: modload.c,v 1.28 2001/09/17 01:40:08 assar Exp $       */
+/*     $NetBSD: modload.c,v 1.29 2001/09/29 21:15:11 jdolecek Exp $    */
 
 /*
  * Copyright (c) 1993 Terrence R. Lambert.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: modload.c,v 1.28 2001/09/17 01:40:08 assar Exp $");
+__RCSID("$NetBSD: modload.c,v 1.29 2001/09/29 21:15:11 jdolecek Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -157,7 +157,7 @@
 }
 
 static int
-verify_entry(char *entry, char *filename)
+verify_entry(const char *entry, char *filename)
 {
        struct  nlist   names[2];
        int n;
@@ -165,8 +165,7 @@
 
        memset(names, 0, sizeof(names));
        s = malloc(strlen(entry) + 2);
-       s[0] = '_';
-       strcpy(s + 1, entry);
+       sprintf(s, "_%s", entry);       /* safe */
 #ifdef _AOUT_INCLUDE_
        names[0].n_un.n_name = s;
 #else
@@ -303,15 +302,13 @@
                /*
                 * Try <modobj>_init if entry is DFLT_ENTRY.
                 */
-               if (entry == DFLT_ENTRY) {
+               if (strcmp(entry, DFLT_ENTRY) == 0) {
                        if ((p = strrchr(modout, '/')))
                                p++;
                        else
                                p = modout;
-                       entry = malloc(strlen(p) + 
-                           strlen(DFLT_ENTRYEXT) + 1);
-                       strcpy(entry, p);
-                       strcat(entry, DFLT_ENTRYEXT);
+                       entry = malloc(strlen(p) + strlen(DFLT_ENTRYEXT) + 1);
+                       sprintf(entry, "%s%s", p, DFLT_ENTRYEXT); /* safe */
                        if (verify_entry(entry, modobj))
                                errx(1, "entry point _%s not found in %s",
                                    entry, modobj);



Home | Main Index | Thread Index | Old Index