diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-03-30 20:55:04 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-03-30 20:55:04 +0000 |
commit | b03cd4b8961d6d01dd208bed592a72ca27b43549 (patch) | |
tree | b98c4a8137e11f1aabb85ded3762dbfb2b850b7e | |
parent | 6a6d2e905f5d3da7fdea6b32e2f69ca78ee53de4 (diff) |
asprintf
partitially from David Hill <david at phobia.ms>
ok deraadt@
-rw-r--r-- | sbin/modload/modload.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sbin/modload/modload.c b/sbin/modload/modload.c index eab4ae42bc5..65afd697e66 100644 --- a/sbin/modload/modload.c +++ b/sbin/modload/modload.c @@ -1,4 +1,4 @@ -/* $OpenBSD: modload.c,v 1.38 2003/03/13 09:09:26 deraadt Exp $ */ +/* $OpenBSD: modload.c,v 1.39 2003/03/30 20:55:03 henning Exp $ */ /* $NetBSD: modload.c,v 1.30 2001/11/08 15:33:15 christos Exp $ */ /* @@ -237,7 +237,7 @@ int main(int argc, char *argv[]) { int strtablen, c, noready = 0, old = 0; - char *kname = _PATH_UNIX; + const char *kname = _PATH_UNIX; char *entry = DFLT_ENTRY; char *post = NULL; char *modobj; @@ -316,17 +316,12 @@ main(int argc, char *argv[]) * Try <modobj>_init if entry is DFLT_ENTRY. */ if (strcmp(entry, DFLT_ENTRY) == 0) { - int len; - if ((p = strrchr(modout, '/'))) p++; else p = modout; - len = strlen(p) + strlen(DFLT_ENTRYEXT) + 1; - entry = malloc(len); - if (entry == NULL) - err(1, "malloc"); - snprintf(entry, len, "%s%s", p, DFLT_ENTRYEXT); + if (asprintf(&entry, "%s%s", p, DFLT_ENTRYEXT) == -1) + err(1, "asprintf"); if (verify_entry(entry, modobj)) errx(1, "entry point _%s not found in %s", entry, modobj); |