mirror of
https://github.com/sheumann/hush.git
synced 2025-01-11 08:29:54 +00:00
syslogd: use _PATH_LOG when available
Signed-off-by: Cédric Cabessa <ccabessa@genymobile.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
985345d002
commit
adc30b4cf9
@ -58,6 +58,9 @@
|
|||||||
#define SYSLOG_NAMES_CONST
|
#define SYSLOG_NAMES_CONST
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
*/
|
*/
|
||||||
|
#ifndef _PATH_LOG
|
||||||
|
#define _PATH_LOG "/dev/log"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
@ -824,8 +827,8 @@ static NOINLINE int create_socket(void)
|
|||||||
|
|
||||||
/* Unlink old /dev/log or object it points to. */
|
/* Unlink old /dev/log or object it points to. */
|
||||||
/* (if it exists, bind will fail) */
|
/* (if it exists, bind will fail) */
|
||||||
strcpy(sunx.sun_path, "/dev/log");
|
strcpy(sunx.sun_path, _PATH_LOG);
|
||||||
dev_log_name = xmalloc_follow_symlinks("/dev/log");
|
dev_log_name = xmalloc_follow_symlinks(_PATH_LOG);
|
||||||
if (dev_log_name) {
|
if (dev_log_name) {
|
||||||
safe_strncpy(sunx.sun_path, dev_log_name, sizeof(sunx.sun_path));
|
safe_strncpy(sunx.sun_path, dev_log_name, sizeof(sunx.sun_path));
|
||||||
free(dev_log_name);
|
free(dev_log_name);
|
||||||
@ -834,7 +837,7 @@ static NOINLINE int create_socket(void)
|
|||||||
|
|
||||||
sock_fd = xsocket(AF_UNIX, SOCK_DGRAM, 0);
|
sock_fd = xsocket(AF_UNIX, SOCK_DGRAM, 0);
|
||||||
xbind(sock_fd, (struct sockaddr *) &sunx, sizeof(sunx));
|
xbind(sock_fd, (struct sockaddr *) &sunx, sizeof(sunx));
|
||||||
chmod("/dev/log", 0666);
|
chmod(_PATH_LOG, 0666);
|
||||||
|
|
||||||
return sock_fd;
|
return sock_fd;
|
||||||
}
|
}
|
||||||
@ -905,7 +908,7 @@ static void do_syslogd(void)
|
|||||||
sz = read(sock_fd, recvbuf, MAX_READ - 1);
|
sz = read(sock_fd, recvbuf, MAX_READ - 1);
|
||||||
if (sz < 0) {
|
if (sz < 0) {
|
||||||
if (!bb_got_signal)
|
if (!bb_got_signal)
|
||||||
bb_perror_msg("read from /dev/log");
|
bb_perror_msg("read from %s", _PATH_LOG);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user