Audit commit 1177c73: musl libc compat changes

Must initialize init_request buffer to zero before communicating with
Finit.  Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-06-04 21:21:24 +02:00
1 parent 34d8848b5c
commit f74a73be20
1 file changed
+5 -5
+5 -5
View File
@@ -77,17 +77,17 @@ exit:
static int runlevel_get(void) static int runlevel_get(void)
{ {
struct init_request rq;
int sd, result = 255; int sd, result = 255;
struct init_request rq;
rq.cmd = INIT_CMD_GET_RUNLEVEL;
rq.magic = INIT_MAGIC;
struct sockaddr_un sun = { struct sockaddr_un sun = {
.sun_family = AF_UNIX, .sun_family = AF_UNIX,
.sun_path = INIT_SOCKET, .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); sd = socket(AF_UNIX, SOCK_STREAM, 0);
if (-1 == sd) if (-1 == sd)
return -1; return -1;