diff --git a/initctl.c b/initctl.c index c45343a8..8fd864e6 100644 --- a/initctl.c +++ b/initctl.c @@ -77,17 +77,17 @@ exit: static int runlevel_get(void) { - struct init_request rq; int sd, result = 255; - - rq.cmd = INIT_CMD_GET_RUNLEVEL; - rq.magic = INIT_MAGIC; - + struct init_request rq; struct sockaddr_un sun = { .sun_family = AF_UNIX, .sun_path = INIT_SOCKET, }; + memset(&rq, 0, sizeof(rq)); + rq.cmd = INIT_CMD_GET_RUNLEVEL; + rq.magic = INIT_MAGIC; + sd = socket(AF_UNIX, SOCK_STREAM, 0); if (-1 == sd) return -1;