unix-socket: be more specific about problems

pull/2445/head
Victor Julien 8 years ago
parent 9368013645
commit 3f741e450b

@ -140,11 +140,21 @@ int UnixNew(UnixCommand * this)
SCLogInfo("Using unix socket file '%s'", sockettarget);
}
if (sockettarget == NULL) {
struct stat stat_buf;
/* coverity[toctou] */
if (stat(SOCKET_PATH, &stat_buf) != 0) {
SCLogWarning(SC_ERR_INITIALIZATION,
"Unix socket: problem with requested directory in %s: %s",
SOCKET_TARGET, strerror(errno));
return 0;
}
sockettarget = SCStrdup(SOCKET_TARGET);
if (unlikely(sockettarget == NULL)) {
SCLogError(SC_ERR_MEM_ALLOC, "Unable to allocate socket name");
return 0;
}
}
/* Remove socket file */

Loading…
Cancel
Save