#include "macro.h"
#include "strv.h"
#include "fileio.h"
-#include "socket-util.h"
#include "microhttpd-util.h"
#ifdef HAVE_GNUTLS
if (child_pid < 0) {
r = -errno;
log_error("Failed to fork: %m");
- close_pipe(fd);
+ safe_close_pair(fd);
return r;
}
_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)
static int spawn_getter(char *getter, char *url) {
int r;
- char _cleanup_strv_free_ **words = NULL, **words2 = NULL;
+ char _cleanup_strv_free_ **words = NULL;
assert(getter);
words = strv_split_quoted(getter);
typedef struct RemoteServer {
RemoteSource **sources;
- ssize_t sources_size;
- ssize_t active;
+ size_t sources_size;
+ size_t active;
sd_event *events;
sd_event_source *sigterm_event, *sigint_event, *listen_event;
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) {
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) {
static int server_destroy(RemoteServer *s) {
int r;
- ssize_t i;
+ size_t i;
MHDDaemonWrapper *d;
r = writer_close(&s->writer);
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);