diff --git a/init/util.cpp b/init/util.cpp index b316d6ec4..c7d031404 100644 --- a/init/util.cpp +++ b/init/util.cpp @@ -105,8 +105,12 @@ int create_socket(const char *name, int type, mode_t perm, uid_t uid, int fd, ret; char *filecon; - if (socketcon) - setsockcreatecon(socketcon); + if (socketcon) { + if (setsockcreatecon(socketcon) == -1) { + ERROR("setsockcreatecon(\"%s\") failed: %s\n", socketcon, strerror(errno)); + return -1; + } + } fd = socket(PF_UNIX, type, 0); if (fd < 0) {