chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
consistently order cleanup attribute before type
[elogind.git]
/
src
/
journal
/
journal-remote.c
diff --git
a/src/journal/journal-remote.c
b/src/journal/journal-remote.c
index 4ece14ee777b9ce9138cc6bfc0fabf851c2ea827..a31dc2c9801137ff44457aa1505319323e9bf579 100644
(file)
--- a/
src/journal/journal-remote.c
+++ b/
src/journal/journal-remote.c
@@
-42,7
+42,6
@@
#include "macro.h"
#include "strv.h"
#include "fileio.h"
#include "macro.h"
#include "strv.h"
#include "fileio.h"
-#include "socket-util.h"
#include "microhttpd-util.h"
#ifdef HAVE_GNUTLS
#include "microhttpd-util.h"
#ifdef HAVE_GNUTLS
@@
-140,7
+139,7
@@
static int spawn_curl(char* url) {
static int spawn_getter(char *getter, char *url) {
int r;
static int spawn_getter(char *getter, char *url) {
int r;
-
char _cleanup_strv_free_
**words = NULL;
+
_cleanup_strv_free_ char
**words = NULL;
assert(getter);
words = strv_split_quoted(getter);
assert(getter);
words = strv_split_quoted(getter);
@@
-155,7
+154,7
@@
static int spawn_getter(char *getter, char *url) {
}
static int open_output(Writer *s, const char* url) {
}
static int open_output(Writer *s, const char* url) {
-
char _cleanup_free_
*name, *output = NULL;
+
_cleanup_free_ char
*name, *output = NULL;
char *c;
int r;
char *c;
int r;
@@
-186,7
+185,7
@@
static int open_output(Writer *s, const char* url) {
if (r < 0)
return log_oom();
} else {
if (r < 0)
return log_oom();
} else {
- r = is_dir(arg_output);
+ r = is_dir(arg_output
, true
);
if (r > 0) {
r = asprintf(&output,
"%s/remote-%s.journal", arg_output, name);
if (r > 0) {
r = asprintf(&output,
"%s/remote-%s.journal", arg_output, name);
@@
-226,8
+225,8
@@
typedef struct MHDDaemonWrapper {
typedef struct RemoteServer {
RemoteSource **sources;
typedef struct RemoteServer {
RemoteSource **sources;
- s
s
ize_t sources_size;
- s
s
ize_t active;
+ size_t sources_size;
+ size_t active;
sd_event *events;
sd_event_source *sigterm_event, *sigint_event, *listen_event;
sd_event *events;
sd_event_source *sigterm_event, *sigint_event, *listen_event;
@@
-257,7
+256,7
@@
static int get_source_for_fd(RemoteServer *s, int fd, RemoteSource **source) {
assert(fd >= 0);
assert(source);
assert(fd >= 0);
assert(source);
- if (!GREEDY_REALLOC0
_T
(s->sources, s->sources_size, fd + 1))
+ if (!GREEDY_REALLOC0(s->sources, s->sources_size, fd + 1))
return log_oom();
if (s->sources[fd] == NULL) {
return log_oom();
if (s->sources[fd] == NULL) {
@@
-276,8
+275,7
@@
static int remove_source(RemoteServer *s, int fd) {
RemoteSource *source;
assert(s);
RemoteSource *source;
assert(s);
- assert(fd >= 0);
- assert(fd < s->sources_size);
+ assert(fd >= 0 && fd < (ssize_t) s->sources_size);
source = s->sources[fd];
if (source) {
source = s->sources[fd];
if (source) {
@@
-293,7
+291,7
@@
static int remove_source(RemoteServer *s, int fd) {
static int add_source(RemoteServer *s, int fd, const char* name) {
RemoteSource *source = NULL;
static int add_source(RemoteServer *s, int fd, const char* name) {
RemoteSource *source = NULL;
-
char *realname
;
+
_cleanup_free_ char *realname = NULL
;
int r;
assert(s);
int r;
assert(s);
@@
-309,11
+307,11
@@
static int add_source(RemoteServer *s, int fd, const char* name) {
return log_oom();
}
return log_oom();
}
- log_debug("Creating source for fd:%d (%s)", fd, name);
+ log_debug("Creating source for fd:%d (%s)", fd,
real
name);
r = get_source_for_fd(s, fd, &source);
if (r < 0) {
r = get_source_for_fd(s, fd, &source);
if (r < 0) {
- log_error("Failed to create source for fd:%d (%s)", fd, name);
+ log_error("Failed to create source for fd:%d (%s)", fd,
real
name);
return r;
}
assert(source);
return r;
}
assert(source);
@@
-747,8
+745,8
@@
static int remoteserver_init(RemoteServer *s) {
}
if (arg_url) {
}
if (arg_url) {
-
char _cleanup_free_
*url = NULL;
-
char _cleanup_strv_free_
**urlv = strv_new(arg_url, "/entries", NULL);
+
_cleanup_free_ char
*url = NULL;
+
_cleanup_strv_free_ char
**urlv = strv_new(arg_url, "/entries", NULL);
if (!urlv)
return log_oom();
url = strv_join(urlv, "");
if (!urlv)
return log_oom();
url = strv_join(urlv, "");
@@
-837,7
+835,7
@@
static int remoteserver_init(RemoteServer *s) {
static int server_destroy(RemoteServer *s) {
int r;
static int server_destroy(RemoteServer *s) {
int r;
- s
s
ize_t i;
+ size_t i;
MHDDaemonWrapper *d;
r = writer_close(&s->writer);
MHDDaemonWrapper *d;
r = writer_close(&s->writer);
@@
-879,7
+877,7
@@
static int dispatch_raw_source_event(sd_event_source *event,
RemoteSource *source;
int r;
RemoteSource *source;
int r;
- assert(fd
<
s->sources_size);
+ assert(fd
>= 0 && fd < (ssize_t)
s->sources_size);
source = s->sources[fd];
assert(source->fd == fd);
source = s->sources[fd];
assert(source->fd == fd);
@@
-1212,8
+1210,8
@@
int main(int argc, char **argv) {
if (remoteserver_init(&s) < 0)
return EXIT_FAILURE;
if (remoteserver_init(&s) < 0)
return EXIT_FAILURE;
- log_debug("%s running as pid
%lu"
,
- program_invocation_short_name,
(unsigned long)
getpid());
+ log_debug("%s running as pid
"PID_FMT
,
+ program_invocation_short_name, getpid());
sd_notify(false,
"READY=1\n"
"STATUS=Processing requests...");
sd_notify(false,
"READY=1\n"
"STATUS=Processing requests...");