chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
networkd, build-sys: spelling fix
[elogind.git]
/
src
/
journal
/
journal-remote.c
diff --git
a/src/journal/journal-remote.c
b/src/journal/journal-remote.c
index 469735663cf85b5b79d1e7164b34bb80d7fc2510..9adad7aabc579d5fc1e283e2537d717e5b4103d8 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
@@
-89,7
+88,7
@@
static int spawn_child(const char* child, char** argv) {
if (child_pid < 0) {
r = -errno;
log_error("Failed to fork: %m");
if (child_pid < 0) {
r = -errno;
log_error("Failed to fork: %m");
-
close_pipe
(fd);
+
safe_close_pair
(fd);
return r;
}
return r;
}
@@
-101,9
+100,7
@@
static int spawn_child(const char* child, char** argv) {
_exit(EXIT_FAILURE);
}
_exit(EXIT_FAILURE);
}
- r = close_pipe(fd);
- if (r < 0)
- log_warning("Failed to close pipe fds: %m");
+ safe_close_pair(fd);
/* Make sure the child goes away when the parent dies */
if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0)
/* Make sure the child goes away when the parent dies */
if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0)
@@
-228,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;
@@
-259,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) {
@@
-278,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) {
@@
-839,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);
@@
-881,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);
@@
-1214,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...");