chiark / gitweb /
journal: add SELinux context to all logged messages
[elogind.git] / src / journal / journal-send.c
index e7e3fa2cd07d39c8112374042d942ffcc9337837..ddf503b18d72663c30de53e6dcb98ac620fa8139 100644 (file)
@@ -195,7 +195,7 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
 
         zero(sa);
         sa.sun_family = AF_UNIX;
-        strncpy(sa.sun_path,"/run/systemd/journal", sizeof(sa.sun_path));
+        strncpy(sa.sun_path,"/run/systemd/journal/socket", sizeof(sa.sun_path));
 
         zero(mh);
         mh.msg_name = &sa;
@@ -209,7 +209,7 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
         return 0;
 }
 
-_public_ int sd_journal_stream_fd(const char *tag, int priority, int priority_prefix) {
+_public_ int sd_journal_stream_fd(const char *identifier, int priority, int level_prefix) {
         union sockaddr_union sa;
         int fd;
         char *header;
@@ -225,7 +225,7 @@ _public_ int sd_journal_stream_fd(const char *tag, int priority, int priority_pr
 
         zero(sa);
         sa.un.sun_family = AF_UNIX;
-        strncpy(sa.un.sun_path, "/run/systemd/stdout", sizeof(sa.un.sun_path));
+        strncpy(sa.un.sun_path, "/run/systemd/journal/stdout", sizeof(sa.un.sun_path));
 
         r = connect(fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
         if (r < 0) {
@@ -233,17 +233,22 @@ _public_ int sd_journal_stream_fd(const char *tag, int priority, int priority_pr
                 return -errno;
         }
 
-        if (!tag)
-                tag = "";
+        if (shutdown(fd, SHUT_RD) < 0) {
+                close_nointr_nofail(fd);
+                return -errno;
+        }
+
+        if (!identifier)
+                identifier = "";
 
-        l = strlen(tag);
+        l = strlen(identifier);
         header = alloca(l + 1 + 2 + 2 + 2 + 2 + 2);
 
-        memcpy(header, tag, l);
+        memcpy(header, identifier, l);
         header[l++] = '\n';
         header[l++] = '0' + priority;
         header[l++] = '\n';
-        header[l++] = '0' + !!priority_prefix;
+        header[l++] = '0' + !!level_prefix;
         header[l++] = '\n';
         header[l++] = '0';
         header[l++] = '\n';