X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Fjournal%2Fjournal-send.c;h=912ecef73cce0d13a5a8967e0752d1acc624fa15;hb=92133d287842dbd7c6d5efc8bd850a47221ebddd;hp=b322127a4e3359e0e95055354ec4c07f4d234737;hpb=4579e8ef313efe56f99a4bdd43439c508a6d49ce;p=thirdparty%2Fsystemd.git
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
index b322127a4e3..912ecef73cc 100644
--- a/src/journal/journal-send.c
+++ b/src/journal/journal-send.c
@@ -1,28 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
-/***
- This file is part of systemd.
-
- Copyright 2011 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see .
-***/
#include
#include
#include
#include
-#include
#include
#include
@@ -31,14 +12,14 @@
#include "sd-journal.h"
#include "alloc-util.h"
+#include "errno-util.h"
#include "fd-util.h"
-#include "fileio.h"
#include "io-util.h"
#include "memfd-util.h"
#include "socket-util.h"
#include "stdio-util.h"
#include "string-util.h"
-#include "util.h"
+#include "tmpfile-util.h"
#define SNDBUF_SIZE (8*1024*1024)
@@ -48,7 +29,7 @@
const char *_func = (func); \
char **_f = &(f); \
_fl = strlen(_func) + 1; \
- *_f = alloca(_fl + 10); \
+ *_f = newa(char, _fl + 10); \
memcpy(*_f, "CODE_FUNC=", 10); \
memcpy(*_f + 10, _func, _fl); \
} while (false)
@@ -416,12 +397,12 @@ _public_ int sd_journal_stream_fd(const char *identifier, int priority, int leve
if (shutdown(fd, SHUT_RD) < 0)
return -errno;
- fd_inc_sndbuf(fd, SNDBUF_SIZE);
+ (void) fd_inc_sndbuf(fd, SNDBUF_SIZE);
identifier = strempty(identifier);
l = strlen(identifier);
- header = alloca(l + 1 + 1 + 2 + 2 + 2 + 2 + 2);
+ header = newa(char, l + 1 + 1 + 2 + 2 + 2 + 2 + 2);
memcpy(header, identifier, l);
header[l++] = '\n';
@@ -441,9 +422,7 @@ _public_ int sd_journal_stream_fd(const char *identifier, int priority, int leve
if (r < 0)
return r;
- r = fd;
- fd = -1;
- return r;
+ return TAKE_FD(fd);
}
_public_ int sd_journal_print_with_location(int priority, const char *file, const char *line, const char *func, const char *format, ...) {
@@ -533,7 +512,7 @@ _public_ int sd_journal_sendv_with_location(
assert_return(iov, -EINVAL);
assert_return(n > 0, -EINVAL);
- niov = alloca(sizeof(struct iovec) * (n + 3));
+ niov = newa(struct iovec, n + 3);
memcpy(niov, iov, sizeof(struct iovec) * n);
ALLOCA_CODE_FUNC(f, func);