must align FILE structures correctly
authorChris Torek <torek@ucbvax.Berkeley.EDU>
Sat, 5 Jun 1993 02:38:46 +0000 (18:38 -0800)
committerChris Torek <torek@ucbvax.Berkeley.EDU>
Sat, 5 Jun 1993 02:38:46 +0000 (18:38 -0800)
SCCS-vsn: lib/libc/stdio/findfp.c 5.11

usr/src/lib/libc/stdio/findfp.c

index d5172de..50be95f 100644 (file)
@@ -9,9 +9,10 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)findfp.c   5.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)findfp.c   5.11 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
+#include <sys/param.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <errno.h>
@@ -47,10 +48,10 @@ moreglue(n)
        register FILE *p;
        static FILE empty;
 
        register FILE *p;
        static FILE empty;
 
-       g = (struct glue *)malloc(sizeof(*g) + n * sizeof(FILE));
+       g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE));
        if (g == NULL)
                return (NULL);
        if (g == NULL)
                return (NULL);
-       p = (FILE *)(g + 1);
+       p = (FILE *)ALIGN(g + 1);
        g->next = NULL;
        g->niobs = n;
        g->iobs = p;
        g->next = NULL;
        g->niobs = n;
        g->iobs = p;