aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-04-10 23:42:12 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-04-15 11:32:40 -0300
commit5ad1a81c8e84eed232ed42a2bf50a160c1447600 (patch)
treeacb82c89ea92e533f8ecbf1e902c68d814885437 /misc
parent7f3ab33f20f19ad5b8fdd40bd77d35a0da355347 (diff)
downloadglibc-5ad1a81c8e84eed232ed42a2bf50a160c1447600.tar
glibc-5ad1a81c8e84eed232ed42a2bf50a160c1447600.tar.gz
glibc-5ad1a81c8e84eed232ed42a2bf50a160c1447600.tar.bz2
glibc-5ad1a81c8e84eed232ed42a2bf50a160c1447600.zip
misc: syslog: Use static const for AF_UNIX address
Checked on x86_64-linux-gnu.
Diffstat (limited to 'misc')
-rw-r--r--misc/syslog.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/misc/syslog.c b/misc/syslog.c
index e228860d22..ee83b1bb76 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -302,8 +302,12 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap,
free (buf);
}
-static struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */
-
+/* AF_UNIX address of local logger */
+static const struct sockaddr_un SyslogAddr =
+ {
+ .sun_family = AF_UNIX,
+ .sun_path = _PATH_LOG
+ };
static void
openlog_internal(const char *ident, int logstat, int logfac)
@@ -317,9 +321,6 @@ openlog_internal(const char *ident, int logstat, int logfac)
int retry = 0;
while (retry < 2) {
if (LogFile == -1) {
- SyslogAddr.sun_family = AF_UNIX;
- (void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
- sizeof(SyslogAddr.sun_path));
if (LogStat & LOG_NDELAY) {
LogFile = __socket(AF_UNIX, LogType | SOCK_CLOEXEC, 0);
if (LogFile == -1)