]> err.no Git - util-linux/commitdiff
initctl: fix strict-aliasing bugs
authorKarel Zak <kzak@redhat.com>
Fri, 16 Oct 2009 21:37:22 +0000 (23:37 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 16 Oct 2009 22:19:23 +0000 (00:19 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/initctl.c

index 6fb8d097fe6bc1160d7ea62526566397438ee5eb..3b38b496749b881ff9d0aa73ad8d814a370b45a5 100644 (file)
@@ -64,8 +64,15 @@ int main (int argc, char **argv)
     struct sigaction sa;
     sigset_t ss;
     char *ptr;
-    long buffer[COMMAND_SIZE / sizeof (long) + 1];
-    struct command_struct *command = (struct command_struct *) buffer;
+    long *buffer;
+    struct command_struct *command;
+
+    buffer = calloc(COMMAND_SIZE / sizeof (long) + 1, sizeof(long));
+    if (!buffer) {
+           fprintf (stderr, "Unable allocate buffer for command\n");
+           exit(1);
+    }
+    command = (struct command_struct *) buffer;
 
     sigemptyset (&ss);
     sigaddset (&ss, SIG_PRESENT);